简体   繁体   中英

Facebook App Invites iOS SDK v4.1 App Crashes while click on invite button

I am using Facebook iOS SDK v4.1 in iOS application. Application is in Development State. I am trying to invite Facebook friends to share Application. I am following This Document .

Kindly check following crashing log for the same.

2015-12-03 16:30:20.888 xyz[8055:160402] +[FBSDKAppInviteDialog showFromViewController:withContent:delegate:]: unrecognized selector sent to class 0x24a85c 2015-12-03 16:30:20.923 xyz[8055:160402] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FBSDKAppInviteDialog showFromViewController:withContent:delegate:]: unrecognized selector sent to class 0x24a85c'

My Code:

FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"https://fb.me/MyAppID"];
//optionally set previewImageURL
content.appInvitePreviewImageURL = [NSURL URLWithString:@"https://www.example.com/image.jpg"];
// present the dialog. Assumes self implements protocol `FBSDKAppInviteDialogDelegate`
[FBSDKAppInviteDialog showFromViewController:self withContent:content delegate:self];

That is an issue on your end. The method showFromViewController was introduced in v4.6 of the Facebook iOS SDK but as you are using v4.1 this method does not exist in the SDK.

You should upgrade to the most recent version of the Facebook SDK for iOS (v4.8 as of now) and then it should work fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM