MajinDageta
MajinDageta

Reputation: 282

FSSDKShareKit - FBSDKShareDialog crash on init iOS

this is my problem: i've fallowed all the steps in https://developers.facebook.com/docs/ios/getting-started

I've downloaded the latest SDK from the official site, i've configured the Facebook App Settings and properly set the plist file.

I've copied the framework needed into the Frameworks folder like described: https://i.sstatic.net/kYXdq.png

I put this in my appDelegate:

    //  AppDelegate.m
#import <FBSDKCoreKit/FBSDKCoreKit.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
    didFinishLaunchingWithOptions:launchOptions];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:sourceApplication
    annotation:annotation
  ];
}

After imporing the FBSDKCore and FBSDKShare in the method triggered by a button I've the fallowing code:

FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:@"my URL"];

FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
dialog.fromViewController = self;
dialog.shareContent = content;
dialog.mode = FBSDKShareDialogModeShareSheet;
[dialog show];

My app crashes on the FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init] with an SIGABRT.

Do you guys have any suggestions?

Thank you very much

EDIT:

I've tried to use a FBSDKShareButton and i got the same issue, crashing on the init... thank you!

Upvotes: 0

Views: 793

Answers (2)

Sam Weng
Sam Weng

Reputation: 21

found a way to solve this problem.. according to the Exception message in debug mode. need to add parameters in Info.plist called LSApplicationQueriesSchemes.

If you're using v4.6.0 of the SDK, you only need to add:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>fbapi</string>
    <string>fb-messenger-api</string>
    <string>fbauth2</string>
    <string>fbshareextension</string>
</array>

refer to Facebook SDK document. https://developers.facebook.com/docs/ios/ios9

Upvotes: 2

Avinash Jadhav
Avinash Jadhav

Reputation: 501

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

return [FBAppCall handleOpenURL:url
              sourceApplication:sourceApplication];}       

This block of code has worked for me. You may try.

Upvotes: 0

Related Questions