Ios Facebook共享源对话框不再可见它将从Facebook本机应用重新重定向到我的应用
嗨,我在使用Facebook提要共享对话框发布图片时遇到了一个奇怪的问题。我使用以下代码:-Ios Facebook共享源对话框不再可见它将从Facebook本机应用重新重定向到我的应用,ios,iphone,facebook,facebook-sdk-3.0,facebook-sdk-3.1,Ios,Iphone,Facebook,Facebook Sdk 3.0,Facebook Sdk 3.1,嗨,我在使用Facebook提要共享对话框发布图片时遇到了一个奇怪的问题。我使用以下代码:- -(IBAction)shaerFacebook { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString
-(IBAction)shaerFacebook
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage2.png"];
NSURL *imageFileURL =[NSURL fileURLWithPath:savedImagePath];
UIImage *imagetoshare=[UIImage imageWithData:[NSData dataWithContentsOfURL:imageFileURL]];
if ([FBDialogs canPresentShareDialogWithParams:params]) {
// Present share dialog
id<FBGraphObject> pictureObject =
[FBGraphObject openGraphObjectForPostWithType:@"mypicture:picture"
title:@"title"
image:imagetoshare
url:imagetoshare
description:@""];
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:pictureObject forKey:@"picture"];
[FBDialogs presentShareDialogWithOpenGraphAction:action
actionType:@"Photoshare:cook"
previewPropertyName:@"picture"
handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
NSLog(@"Error: %@", error.description);
} else {
NSLog(@"Success");
}
}];
// If the Facebook app is NOT installed and we can't present the share dialog
}
}
-(iAction)shaerFacebook
{
NSArray*Path=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,是);
NSString*documentsDirectory=[paths objectAtIndex:0];
NSString*savedImagePath=[DocumentsDirectoryStringByAppendingPathComponent:@“savedImage2.png”];
NSURL*imageFileURL=[NSURL fileURLWithPath:savedImagePath];
UIImage*imagetoshare=[UIImage imageWithData:[NSData dataWithContentsOfURL:imageFileURL]];
if([FBDialogs可以显示ShareDialogwithParams:params]){
//显示共享对话框
id图片对象=
[FBGraphObjectOpenGraphObjectForPostWithType:@“mypicture:picture”
标题:@“标题”
图片:imagetoshare
url:imagetoshare
说明:@“];
id action=(id)[FBGraphObject graphObject];
[action setObject:pictureObject forKey:@“picture”];
[FBDialogs presentShareDialogWithOpenGraphAction:操作
actionType:@“Photoshare:cook”
previewPropertyName:@“图片”
处理程序:^(FBAppCall*调用,NSDictionary*结果,NSError*错误){
如果(错误){
NSLog(@“错误:%@”,错误描述);
}否则{
NSLog(“成功”);
}
}];
//如果没有安装Facebook应用程序,我们无法显示共享对话框
}
}
它将导航到facebook
native应用程序,显示带有图像的对话框,并在一秒钟内重定向到我无法发布的应用程序。我做了很多谷歌,但没有得到解决方案。请帮我解决这个问题,我错在哪里了
facebook应用程序是否有任何特定的更改 为什么还要将imagetoshare作为url传递?这将无法解析,因为Facebook需要一个url,但你给了它一个UIImage。如果我把图像的NSURL放在那里,那么它将变成cresh