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?