2014-04-08 3 views
0

내 애플리케이션에서 Facebook으로 게시물을 공유하려고합니다. '사진'키에 이미지 링크를 입력하면 잘 작동하지만 내 사진 중 하나를 공유하면 앱이 다운됩니다. 이것은 내가 이미지는 10 * 10 이미지 및 오류가 Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage length]: unrecognized selector sent to instance 0xab7b900'입니다facebook의 앱에서 이미지를 공유하려고 할 때 앱이 작동을 멈 춥니 다.

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Magic Photo from Abracadabra Snap!", @"name",@"Edit photos, move objects around,remove photo bombs", @"caption",@"Use automatic object detector to select objects or make your own custom selection.Remove the unwanted objects or photobomb,or move objects around.Do crazy stuff with your pictures , save and share with friends.", @"description",@"http://www.arkhitech.com/abracadabra/", @"link",tempImageForFacebookShare, @"picture",nil]; 

// Show the feed dialog 
[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) 
{ 
      if (error) 
       { 
       // An error occurred, we need to handle the error 
       // See: https://developers.facebook.com/docs/ios/errors 
       NSLog([NSString stringWithFormat:@"Error publishing story: %@", error.description]); 
       } 
      else { 

       if (result == FBWebDialogResultDialogNotCompleted) 
       { 
        // User cancelled. 
        NSLog(@"User cancelled."); 
       } 
      else 
      { 
       // Handle the publish feed callback 
       NSDictionary *urlParams = [self parseURLParams:[resultURL query]]; 

      if (![urlParams valueForKey:@"post_id"]) 
       { 
       // User cancelled. 
       NSLog(@"User cancelled."); 

       } 
      else 
       { 
       // User clicked the Share button 
       NSString *result = [NSString stringWithFormat: @"Posted story, id: %@", [urlParams valueForKey:@"post_id"]]; 
       NSLog(@"result %@", result); 
       } 
      } 
     } 
}]; 

을 사용하고있는 코드입니다. 이 문제에 대해 안내해주십시오

답변

1

이 API는 string의 수대로하는 UIImage 작동하지 않습니다

사진 : 링크와 관련된 미리보기 이미지를 결정합니다. 문자열

출처 : Graph API Reference

picture 매개 변수는 링크에 대한 미리보기 이미지 및 업로드 할 수 없습니다.

-1

코드는 유효하지만 보이면 에 UIImages이 포함될 것으로 예상하여 UIImage을 Facebook에 보냅니다.

@[tempImageForFacebookShare], @"picture",

을 그리고 그것은 문제를 해결 한 경우 참조 :

다음과 같이 NSDictionary 코드를 변경하십시오.

+0

작동하지 않습니다. 그것의 허가 문제가 있지만 전체 OAuth 과정을 통과하고 싶지 않다. –

+0

-1 Api는 NSArray를 기대하지 않지만 NSString을 기대한다. – lootsch