gpt4 book ai didi

ios - 在 Facebook 3.5 iOS SDK 中使用 FBRequest 发布开放图操作时出错

转载 作者:可可西里 更新时间:2023-11-01 04:47:22 27 4
gpt4 key购买 nike

我正在尝试使用以下代码使用 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

最佳答案

在您的 startForPostWithGraphPath 中,您正在传递刚刚创建的“对象”,但是,您不能将其作为打开图形操作的一部分传递。你应该做的是查看返回的“结果”,从中获取“id”,然后构造一个 NSDictionary(或 FBOpenGraphObject),类似于:

@{ @"quote": 对象ID}

其中 objectID 是第一个帖子结果中的“id”。

关于ios - 在 Facebook 3.5 iOS SDK 中使用 FBRequest 发布开放图操作时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16417476/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com