2012-09-03 60 views
2

在我的iOS應用程序,我成功地集成最新的Facebook的框架。
其工作正常,如果「臉譜」的應用程序是不是在我的iPhone。如果該應用程序不在我的iphone上,則在進行身份驗證時,會打開瀏覽器並正確進行身份驗證。
但是,如果Facebook應用程序在我的iphone上,在身份驗證和返回到我的應用程序後,其崩潰與以下錯誤:
由於未捕獲異常'NSInvalidArgumentException'終止應用程序,原因:' - [SBJsonParser errorTrace]:無法識別選擇發送到實例0x2d9f60'iOS版 - 整合Facebook的框架


我已經看到Facebook提供的樣品和我的應用程序中實現相同。有人能指出我可能會遇到什麼問題嗎?

+0

通過iPhone內部登錄勝任的問題可能是你有在SBJson庫的版本。看看這個類似的問題:http://facebook.stackoverflow.com/questions/12301617/application-crash-on-login-in-ios-facebook-sdk-3-0 – borisdiakur

回答

1

這是一個位在黑暗中刺,但我想你可能會就SBJsonParser :)

什麼是可能發生的事情是你打電話errorTrace的東西,你已經發布了一個實例調用方法errorTrace早。通過觸發的代碼路徑去當Facebook重新打開你的應用程序,並找到errorTrace通話。在它之前設置一個斷點並查看看看有什麼不對。

+1

它已經從FB框架。所以我不能放任何斷點來追蹤它。沒有FB應用程序在我的iPhone上,它的工作正常。隨着設備上的Facebook應用程序,它的崩潰。 – Satyam

+0

同樣的問題在這裏 –

0

如果你只想在iOS版6.0共享的東西,所以你使用的社會和帳戶框架,並使用下面的代碼

-(void)facebook_Share_in_IOS6.0{ 

    if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) //check if Facebook Account is linked 
    { 
     mySLComposerSheet = [[SLComposeViewController alloc] init]; //initiate the Social Controller 
     mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him with what social plattform to use it, e.g. facebook or twitter 
     [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"Test",mySLComposerSheet.serviceType]]; //the message you want to post 
    // [mySLComposerSheet addImage:yourimage]; 

     [self presentViewController:mySLComposerSheet animated:YES completion:nil]; 
    }else{ 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Attention" message:@"First Set your facebook account. To post your answer to facebook" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alert show]; 
    } 
    [mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) { 
     NSString *output; 
     switch (result) { 
      case SLComposeViewControllerResultCancelled: 
       output = @"Action Cancelled"; 
       break; 
      case SLComposeViewControllerResultDone: 
       output = @"Post Successfull"; 
       break; 
      default: 
       break; 
     } //check if everything worked properly. Give out a message on the state. 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 
     [alert show]; 
    }]; 
} 
+0

我們不能使用相同的iOS5上... – Satyam