3
顯示我正在開發一個簡單的應用程序,有一個功能組成的用戶圖片和張貼他們爲OG故事到Facebook。API返回成功後OG,但它並沒有在Facebook上的個人資料
我跟着Facebook的文檔,我發出POST請求(我知道我可以批量他們,我只是試圖讓任何版本的工作),我得到一個故事的ID,但我無法找到Facebook上的故事。 當我在圖形瀏覽器檢查該路徑返回一個空:(權限設置爲朋友)
我與路徑/我/張貼{「數據」:[]} 我知道這個故事贏得」張貼在我的個人資料上,但我需要在某個地方看到它。
我需要測試的東西,如深層鏈接(我知道URL當前設置爲無),但我無法找到的故事!我唯一可以看到的圖片是當我去 開發者頁面並點擊'預覽'。
任何想法? 在此先感謝。
這裏是源代碼:
- (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);
}
}];
}