2013-01-24 10 views
5

SDK iOS 3.1で新しいアプリを開始したばかりです。読み書きの権限が分かれていることに気付きました。ios SDK 3.1で壁に公開する簡単な方法

私はopenActiveSessionWithReadPermissionsのCompletionHandlerで書き込み権限のために、私は次のようなエラーに

*** Terminating app due to uncaught exception 'com.facebook.sdk:InvalidOperationException', reason: 'FBSession: It is not valid to reauthorize while a previous reauthorize call has not yet completed.' 
を得ることができる場合、私は、ユーザーの壁に公開するための簡単な方法を探しているが、私は、認可メカニズム

で少し混乱ミリアンペアメートル

completionHandlerはアクションが完了したように聞こえるので、このコードで何が問題なのか分かりません。

提案がありますか?

-(void)askWritePerms 
{ 
NSArray *permissions = [NSArray arrayWithObjects:@"publish_actions", nil]; 

[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions 
          defaultAudience:FBSessionDefaultAudienceFriends 
         completionHandler:^(FBSession *session, NSError *error) { 


    }]; 

} 


- (IBAction)publishFB:(id)sender 
{ 


     NSArray *permissions = [NSArray arrayWithObjects:@"email", nil]; 

     [FBSession openActiveSessionWithReadPermissions:permissions 
            allowLoginUI:YES 
           completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { 
          [self askWritePerms]; 

        } 
+0

あなたは、セッションの状態であるかどうか確認しましたか?あなたはステータスの価値を記録できますか? –

答えて

0
For publishing in wall in facebook use the following code 
[[FBSession activeSession] reauthorizeWithPublishPermissions:@[ @"publish_stream",@"publish_actions" ] defaultAudience:FBSessionDefaultAudienceEveryone completionHandler:^(FBSession *authSession, NSError *authError) { 

      // If auth was successful, create a status update FBRequest 
      if (!authError) { 
NSMutableDictionary* photosParams = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                imageurl,@"source", 
                urlstring,@"link",@"Appname",@"name",@"Your app description",@"description", 
                nil]; 


       [FBRequestConnection startWithGraphPath:@"me/feed" parameters:photosParams HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { 
       if (error) 
       { 
        [self showAlert:@"Connection Error...Try Again"]; 
} 
     }]; 
      } 
      }]; 
関連する問題