Search code examples
xamarinxamarin.iosfacebook-ios-sdk

App won't start with Xamarin iOS Facebook SDK


I have no idea what's going wrong. I just want to integrate the Facebook iOS SDK from Xamarin and call the 'ActivateApp' Event, so that I can see how many users opened the app from the Facebook-App with an ad from me.

I created a blank Xamarin.Forms app, added the component from the component store and modified my AppDelegate class:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    Settings.AppID = "<myFacebookId>";

    global::Xamarin.Forms.Forms.Init();
    LoadApplication(new App());

    return base.FinishedLaunching(app, options);
}

I am aware that I need to update the Info.plist file also and do some more stuff. But the special here is, with above steps the app won't start on my device (Configuration: Debug | iPhone, Linker disabled, sdk Version 9.2, deployment target 7.1) but on my smulator it works fine.

On the device, the splashscreen just shows for half a second, then it crashs without any Feedback.

My brain explodes next time. Any help is appreciated. Thanks


Solution

  • Thanks to the Xamarin-support, I have a solution for my problem.

    Answer from the Support:

    It looks like the issue you are hitting is related to App Transport Security, so you’ll need to whitelist a couple things by editing your plist to fix the crash on device. You can read more about how to do this in the Facebook developer guide, “Preparing Your Apps for iOS 9”:

    Basically, what you’ll do is this:

    1. Double-click info.plist and go to Source tab
    2. Add Custom Property “LSApplicationQueriesSchemes”, type “Array”
    3. Add Strings with the following values: fbapi, fb-messenger-api, fbauth2, fbshareextension

    It’s a little bit akward… As I wrote you in my question, I am aware that there are more things to do (like editing the plist-file). But unfortunately, I obviously put the wrong values in my plist-file.