HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了使用FBRequest在Facebook 3.5 iOS SDK中发布打开图表操作时出错大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用iOS SDK发布开放图形操作,使用以下代码

[FBrequestConnection startForUploadStagingresourceWithImage:image completionHandler:^(FBrequestConnection *connection,id result,NSError *error) {
        if (!error){
            NSString *uri = [result valueForKey:@"uri"];

            NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost];
            object.provisionedForPost = YES;
            object[@"type"] = @"myapp:Quote";
            object[@"image"] = uri;
            object[@"title"] = @"check out my quote";

            [FBrequestConnection startForPostOpenGraphObject:object
                       completionHandler:^(FBrequestConnection *connection,NSError *error) {
                           if(error) {
                               NSLog(@"Error: %@",error);
                           } else {

                               NSString *graPHPath = [NSString StringWithFormat:@"me/quotestagramapp.quote"];
                               [FBrequestConnection startForPostWithGraPHPath:graPHPath
                                                                  graphObject:object
                                                            completionHandler:^(FBrequestConnection *connection,NSError *error) {
                                                                if (error){
                                                                    NSLog(@"Error is %@",[error description]);
                                                                } else {
                                                                    NSLog(@"@R_772_6048@sful");
                                                                }
                                                            }];
                           }
                       }];
        } else {
            NSLog(@"Error uploading image to fb staging");
        }
    }];

但是我收到一个错误然后应用程序在我的startForPostWithOpenGraPHPath中崩溃了.
这是错误

*** TerminaTing app due to uncaught exception 'NSInvalidArgumentexception',reason: '-[__NSCFBoolean dataUsingEncoding:]: unrecognized SELEctor sent to instance 0x3a9be530'
*** First throw call stack:
(0x3261c2a3 0x3a34497f 0x3261fe07 0x3261e531 0x32575f68 0x1e9ac1 0x1e9b8d 0x1eb521 0x1ec639 0x1eca19 0x1eb28d 0x1ea0f9 0x1eac49 0x1e5ca5 0x110ecb 0x1edc11 0x1ece77 0x1eaebf 0x1ef3af 0x1ef2e9 0x1ef923 0x32f576fd 0x32e971f9 0x32e97115 0x322f945f 0x322f8b43 0x32320fcb 0x3256274d 0x3232142b 0x3228503d 0x325f1683 0x325f0ee9 0x325efcb7 0x32562ebd 0x32562d49 0x3613b2eb 0x34478301 0x109bb1 0xfd3b8)
libc++abi.dylib: terminate called throwing an exception

解决方法

在startForPostWithGraPHPath中,您传递的是刚创建的“对象”,但是,您无法将其作为开放图形操作的一部分传递.您应该做的是查看返回的“结果”,从中获取“id”,并使用以下@L_489_12@构造NSDictionary(或FBOpenGraphObject):

@ {@“quote”:objectID}

其中objectID是第一篇文章结果中的“id”.

大佬总结

以上是大佬教程为你收集整理的使用FBRequest在Facebook 3.5 iOS SDK中发布打开图表操作时出错全部内容,希望文章能够帮你解决使用FBRequest在Facebook 3.5 iOS SDK中发布打开图表操作时出错所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。