2012-09-29 11 views
6

मैं openActiveSessionWithPublishPermissions का उपयोग कर फेसबुक पर प्रकाशित करने के लिए कोशिश कर रहा हूँ हस्ताक्षर करने के बाद कहा जाता है नहीं तो अगर में वह पहली बार प्रवेश करने की जरूरत है उपयोगकर्ता लॉगिन नहीं है और फिर संदेश io6 फेसबुक देशी संवाद का उपयोग करके पोस्ट।फेसबुक iOS6 completionHandler, में

जो मैंने पाया वह है कि मैं लॉगिन करने में सक्षम हूं, लेकिन पूरा करने वाला हैंडलर नहीं कहा जाता है।

एक और बात मैंने देखा है, कि जब मैं प्रवेश बटन फिर से क्लिक करें, यह तो निम्न त्रुटि FBSessionStateClosedLoginFailed साथ पूरा होने हैंडलर कहता है।

मैंने this post का संदर्भ दिया लेकिन अभी भी मेरी समस्या का समाधान नहीं मिला।

NSArray *permissions = [NSArray arrayWithObjects:@"publish_stream", nil]; 
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler: 
^(FBSession *session, FBSessionState status, NSError *error) 
{ 

    switch (status) { 

        case FBSessionStateOpen: 
         { 
          [FBNativeDialogs presentShareDialogModallyFrom:currentController initialText:nil image:nil url:nil handler:^(FBNativeDialogResult result, NSError *error) {}]; 
         } 
         break; 
        default: 
         break; 
        } 
       }]; 

उत्तर

0

आप इस जोड़ने के लिए होना चाहिए:

[FBNativeDialogs presentShareDialogModallyFrom:currentController initialText:nil 
    image:nil url:nil handler:^(FBNativeDialogResult result, NSError *error) { 
    if (result==FBNativeDialogResultCancelled) { 
    UIAlertView  *alert=[[UIAlertView alloc]initWithTitle:@"Error" 
     message:@"Sending Cancelled" delegate:self cancelButtonTitle:@"OK" 
     otherButtonTitles: nil]; 
    [alert show]; 
} else if (result==FBNativeDialogResultSucceeded) { 
    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Succeed" 
    message:@"succeed" delegate:self cancelButtonTitle:@"OK" 
    otherButtonTitles: nil]; 
    [alert show]; 
}***}***]; 
5

सुनिश्चित करें कि आप लागू किया handleOpenUrl विधि बनाएं।

-(BOOL)application:(UIApplication *)application 
      openURL:(NSURL *)url 
sourceApplication:(NSString *)sourceApplication 
     annotation:(id)annotation { 

    return [[FBSession activeSession] handleOpenURL:url]; 

} 
+0

ऐसा किया गया है, मैंने पहले से ही यह कोड जोड़ा था। – andyPaul

संबंधित मुद्दे