嗨,我在使用 Facebook 提要共享对话框发布图片时遇到了奇怪的问题。我正在使用以下代码:-
-(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
}
}
它将导航facebook
本机应用程序显示带有图像的对话框,并在一秒钟内重定向到我无法发布的我的应用程序。我做了很多谷歌但没有得到解决方案。请帮我解决我在哪里弄错了。
facebook应用程序有什么具体变化吗?