parse-platformparsefacebookutils

PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions) giving compilation error


I'm trying to integrate facebook login in my parse application. I followed every step mentioned in parse tutorial. In the below code, I'm getting compilation error.

 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
    line1: Parse.setApplicationId("xxx", clientKey: "yyy")
    line2: PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)       
    line3: PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
    line4: return true
}

In line 3, I'm getting error:

Value of optional type '[NSObject:AnyObject]' not unwrapped; did you mean to use '!' or '?'?

If I manually unwrap it using '!', because launchOptions can be nil, I get:

Fatal error: unexpectedly found nil while unwrapping an Optional value

If I check for nil, I get:

NSInternalInconsistencyException', reason: 'You must initialize PFFacebookUtils with a call to +initializeFacebookWithApplicationLaunchOptions

Any idea how to fix it?


Solution

  • It is a bug in ParseSDK. Until Parse fix this you can change the initialize function declaration at PFFacebookUtils.h header file

    1) Go to PFFacebookUtils.h

    2) change:

    To:

    This answer was provided by Kiarash Akhlaghi at https://developers.facebook.com/bugs/1462780714012820/