Ios 尝试在facebook上共享应用程序中的图像时,应用程序崩溃
我正在尝试将我的应用程序中的帖子分享到facebook上。当我在“图片”键中输入一个图片链接时,它可以正常工作,但当我将自己的一张图片分享时,应用程序崩溃。这是我正在使用的代码Ios 尝试在facebook上共享应用程序中的图像时,应用程序崩溃,ios,facebook,ios7,unrecognized-selector,facebook-sdk-3.1,Ios,Facebook,Ios7,Unrecognized Selector,Facebook Sdk 3.1,我正在尝试将我的应用程序中的帖子分享到facebook上。当我在“图片”键中输入一个图片链接时,它可以正常工作,但当我将自己的一张图片分享时,应用程序崩溃。这是我正在使用的代码 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Magic Photo from Abracadabra Snap!", @"name",@"Edit photos, move objects around
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Magic Photo from Abracadabra Snap!", @"name",@"Edit photos, move objects around,remove photo bombs", @"caption",@"Use automatic object detector to select objects or make your own custom selection.Remove the unwanted objects or photobomb,or move objects around.Do crazy stuff with your pictures , save and share with friends.", @"description",@"http://www.arkhitech.com/abracadabra/", @"link",tempImageForFacebookShare, @"picture",nil];
// Show the feed dialog
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
if (error)
{
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]);
}
else {
if (result == FBWebDialogResultDialogNotCompleted)
{
// User cancelled.
NSLog(@"User cancelled.");
}
else
{
// Handle the publish feed callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"post_id"])
{
// User cancelled.
NSLog(@"User cancelled.");
}
else
{
// User clicked the Share button
NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]];
NSLog(@"result %@", result);
}
}
}
}];
该映像是一个10*10映像,由于未捕获的异常“NSInvalidArgumentException”,错误是
终止应用程序,原因:'-[UIImage length]:未识别的选择器发送到实例0xab7b900'
。请就这个问题提供指导您的代码看起来有效,但您正在向Facebook发送一个UIImage
,Facebook希望在其中包含UIImages
的NSArray
请按如下方式更改您的NSDictionary
代码:
@[tempImageForFacebookShare],@“图片”,
并查看是否已修复问题。它不适用于
UIImage
,因为Api只允许字符串
s:
图片:确定与链接关联的预览图像字符串
资料来源:
picture
参数是链接的预览图像,无法上载。不起作用。这是一个权限问题,但我不想经历整个OAuth过程-1 Api不希望出现NSArray
,而是NSString
。