我正在尝试使用以下代码发布使用 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, id result, NSError *error) {
if(error) {
NSLog(@"Error: %@", error);
} else {
NSString *graphPath = [NSString stringWithFormat:@"me/quotestagramapp.quote"];
[FBRequestConnection startForPostWithGraphPath:graphPath
graphObject:object
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (error){
NSLog(@"Error is %@", [error description]);
} else {
NSLog(@"Successful");
}
}];
}
}];
} 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