Reputation: 731
I am finding this error in my AppDelegate.swift file and it appears in the AppDidFinishLaunchingWithOptions function. It is raising the error on a line of code that is from the Parse framework.
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
The error is appearing on the launchOptions
parameter. I will post the whole function to show that it should be correct. Also when I comment out the line of code the error disappears, but I still really want to be able to use the function and track the analytics. Here is the whole function:
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: AnyObject!) -> Bool
{
// Override point for customization after app launches
Parse.setApplicationId("removed on purpose", clientKey: "removed on purpose")
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
PFFacebookUtils.initializeFacebook()
return true
}
I can't seem to find anything that relates to this error. If anyone has some insight I would really appreciate it!
Upvotes: 2
Views: 1305
Reputation: 92409
Since Xcode 6 beta 7, when you want to call application:didFinishLaunchingWithOptions:
, you have to replace:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
/* ... */
}
with the following code:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
/* ... */
}
The last parameter of this method is no more a NSDictionary but a Dictionary of type [NSObject: AnyObject]?
. Therefore, you must update your code (including your trackAppOpenedWithLaunchOptions:
parameter type).
Upvotes: 2
Reputation: 93276
The launchOptions
parameter should be declared as NSDictionary!
instead of AnyObject!
:
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
// ...
}
Upvotes: 1