Facebook SDK 3.1 presentShareDialogModally not working

I try to check out the new built-in β€œsheet” for Facebook on iOS 6, but when I run the sample code, it does not show the sheet. Instead, he posts the status to me, not showing that he is going to publish first. In addition, I thought that Facebook does not allow you to enter words into the user's mouth anymore? The console prints this error: HelloFacebookSample Error: HTTP status code: 400

I have Xcode 4.5 and iOS simulator 6.0 and Facebook SDK 3.1

I follow this: http://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/3.1/

+4
source share
3 answers

Have you set up a Facebook account on your device / simulator (under "Settings"> "Facebook")?

Dialogs of embedded sheets are displayed only if the application is running on ios 6, and the user is authenticated through the ios 6 Facebook account. Otherwise, the handler reports this error, and presentShareDialogModallyFrom returns NO. In addition, the FBNativeDialogResult result in the handler will be equal to FBNativeDialogResultError .

+10
source

You are missing some of the necessary frameworks:

AdSupport.framework

Account.framework

Social.framework

 BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self initialText:self.shareText image:nil url:nil handler:^(FBNativeDialogResult result, NSError *error) { if (error) { /* handle failure */ NSLog(@"error:%@, %@", error, [error localizedDescription]); } else { if (result == FBNativeDialogResultSucceeded) { /* handle success */ NSLog(@"handle success"); } else { /* handle user cancel */ NSLog(@"user cancel"); } } }]; if (!displayedNativeDialog) { /* handle fallback to native dialog */ } 
+2
source

Make sure you do not open sessions using legacy methods (e.g. .openActiveSessionWithPermissions instead of the new openActiveSessionWithReadPermissions / openActiveSessionWithWritePermissions) or facebook sdk will not use the built-in integration with facebook (i.e. native dialogs)

+2
source

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


All Articles