Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 尝试在facebook上共享应用程序中的图像时,应用程序崩溃_Ios_Facebook_Ios7_Unrecognized Selector_Facebook Sdk 3.1 - Fatal编程技术网

Ios 尝试在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

我正在尝试将我的应用程序中的帖子分享到facebook上。当我在“图片”键中输入一个图片链接时,它可以正常工作,但当我将自己的一张图片分享时,应用程序崩溃。这是我正在使用的代码

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