gpt4 book ai didi

ios - API 为 OG Post 返回成功,但它没有出现在 Facebook 个人资料中

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:40:27 32 4
gpt4 key购买 nike

我正在开发一个简单的应用程序,它具有合成用户图片并将它们作为 OG 故事发布到 Facebook 的功能。

我遵循了 Facebook 文档并发出了 POST 请求(我知道我可以对它们进行批处理,我只是想让任何版本都能正常工作),我确实得到了一个故事 ID,但我找不到Facebook 上的故事。 (权限设置为好友)

我用路径/me/发布它:当我 checkin Graph Explorer 时,此路径返回一个空的 { 'data' : [] }我知道这个故事不会发布在我的个人资料中,但我需要在某个地方看到它。

我需要测试诸如深度链接之类的东西(我知道 url 当前设置为 nil),但我找不到故事!我唯一能看到这张照片的地方是我去的时候开发人员页面,然后单击“预览”。

有什么想法吗?提前致谢。

这是源代码:

- (void) publishPhoto
{
// stage an image
[FBRequestConnection startForUploadStagingResourceWithImage:self.photo.image completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error) {
NSLog(@"Successfuly staged image with staged URI: %@", [result objectForKey:@"uri"]);

// instantiate a Facebook Open Graph object
NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPostWithType:@"<APPNAMESPACE>:picture" title:@"" image:@[@{@"url":[result objectForKey:@"uri"], @"user_generated" : @"true"}] url:nil description:@""];

// Post custom object
[FBRequestConnection startForPostOpenGraphObject:object completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error) {
// get the object ID for the Open Graph object that is now stored in the Object API
NSString *objectId = [result objectForKey:@"id"];
NSLog([NSString stringWithFormat:@"object id: %@", objectId]);

// create an Open Graph action
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
[action setObject:objectId forKey:@"picture"];

// create action referencing user owned object
[FBRequestConnection startForPostWithGraphPath:@"/me/<APPNAMESPACE>:take" graphObject:action completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if(!error) {
NSLog([NSString stringWithFormat:@"OG story posted, story id: %@", [result objectForKey:@"id"]]);
[[[UIAlertView alloc] initWithTitle:@"OG story posted"
message:@"Check your Facebook profile or activity log to see the story."
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil] show];
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"Encountered an error posting to Open Graph: %@", error.description);
}
}];

} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"Encountered an error posting to Open Graph: %@", error.description);
}
}];

} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
NSLog(@"Error staging an image: %@", error.description);
}
}];
}

最佳答案

请尝试使用 iPhone 设备而不是模拟器。它会起作用

关于ios - API 为 OG Post 返回成功,但它没有出现在 Facebook 个人资料中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21120941/

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