IOS Facebook SDK MessageDialog error 202

I am trying to set up Facebook file sharing with FBSDK in an iOS application.

I read the documentation here and now

[FBSDKShareDialog showFromViewController:self withContent:content delegate:self]; 

works with a content object - FBSDKShareLinkContent .

However, trying to use a similar method specified for sharing Facebook Messenger,

 [FBSDKMessageDialog showWithContent:content delegate:self]; 

I get a crash. I caught the error and registered it in one of the delegation methods, and it says: "The operation cannot be completed (error com.facebook.sdk.share 202.)"

I searched for this particular error, but did not find anything with the same error. Here is the complete code

 FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; content.contentURL = [NSURL URLWithString:kAPPShareLink]; content.contentDescription = kAPPShareDescription; content.contentTitle = kAPPShareTitle; if (buttonIndex == 0) { // Facebook [FBSDKShareDialog showFromViewController:self withContent:content delegate:self]; } else if (buttonIndex == 1) { // Facebook Messenger [FBSDKMessageDialog showWithContent:content delegate:self]; } 

Forgive me if I miss something obvious, but as this documentation reads, I assume that the FBSDKMessageDialog showWithContent: method will work just like the FBSDKShareDialog showFromViewController: which FBSDKShareDialog showFromViewController: for me.

  • I am using the latest version of Xcode with iOS8.
+6
source share
3 answers

I needed to log in and then send, this is how it works:

 FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; [login logInWithReadPermissions:@[@"email"] handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { if (error) { // Process error } else if (result.isCancelled) { // Handle cancellations } else { FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init]; content.contentURL = [NSURL URLWithString:@"https://developers.facebook.com/"]; FBSDKMessageDialog *messageDialog = [[FBSDKMessageDialog alloc] init]; messageDialog.delegate = self; [messageDialog setShareContent:content]; if ([messageDialog canShow]) { [messageDialog show]; } else { // Messenger isn't installed. Redirect the person to the App Store. [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/en/app/facebook-messenger/id454638411?mt=8"]]; } } }]; 

and Delegate Share:

 - (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results { NSLog(@"didCompleteWithResults"); } - (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error { NSLog(@"didFailWithError ::: %@" , error); } - (void)sharerDidCancel:(id<FBSDKSharing>)sharer { NSLog(@"sharerDidCancel"); } 

Edit:

[messageDialog canShow] returns NO on iPad, works great on iPhone

A question has been posted about the Facebook Developer Forum .

+6
source

Note: This is more like a comment, but so far I have not enough reputation to leave comments

I get the same error, updated both Facebook and instant messenger.

I checked my permissions with

 [[FBSDKAccessToken currentAccessToken] permissions] 

and I think I have enough:

 "contact_email", "publish_stream", "user_likes", "publish_checkins", "video_upload", "create_note", "basic_info", "publish_actions", "public_profile", "photo_upload", "status_update", email, "user_friends", "share_item" 

I tried the same as OP and also tried:

 FBSDKMessageDialog *messageDialog = [[FBSDKMessageDialog alloc] init]; [messageDialog setShareContent:content]; messageDialog.delegate = self; if ([messageDialog canShow]) { [messageDialog show]; } 

[messageDialog canShow] returns NO , and the delegate methods catch an error with error 202 described by the OP.

I tried using FBSDKSendButton and not working.

FBSDKShareDialog, on the other hand, works fine ...

Hope this helps solve the problem.

+1
source

This again surfaced in a mutual search. There is currently a simple answer to the error Message dialog is not available with code 202 :

Facebook Documentation :

Note. The message dialog is not currently supported on the iPad.

+1
source

Source: https://habr.com/ru/post/984485/


All Articles