2014-01-14 2 views
3

사용자 사진을 작성하고 페이스 북에 OG Story로 게시하는 기능이있는 간단한 앱을 개발 중입니다.API는 OG Post에 대한 성공을 반환하지만 페이스 북 프로필에는 표시되지 않습니다.

나는 Facebook 문서를 따라 POST 요청을 발행하고 있습니다. (일괄 처리 할 수 ​​있다는 것을 알고 있으며, 어떤 버전이든 작동하려고합니다.) 이야기 ID를 얻지 만 찾을 수 없습니다. 페이스 북에 대한 이야기. 내가 그래프 탐색기에서 검사 할 때 이 경로가 빈 반환 : (친구로 설정 허가)

나는 경로가/나 /를 함께 게시하도록하겠습니다 { '데이터를': []} 나는 '이야기가 원 알고 내 프로필에 게시해야하지만 어딘가에 있어야합니다.

딥 링크 (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); 
     } 
    }]; 
} 

답변

0

아이폰 장치 대신 시뮬레이터를보십시오 : 여기

는 소스 코드입니다. 잘 작동 할 것입니다.