![](/img/trans.png)
[英]'[NSObject : AnyObject]' is not identical to 'NSDictionary', trouble with RKPathMatcher
[英]'AnyObject' is not identical to '[NSObject : AnyObject]'
我在AppDelegate.swift文件中發現此錯誤,它出現在AppDidFinishLaunchingWithOptions函數中。 它在來自Parse框架的代碼行中引發錯誤。
PFAnalytics.trackAppOpenedWithLaunchOptions(launchOptions)
該錯誤出現在launchOptions
參數上。 我將發布整個函數以表明它應該是正確的。 同樣,當我注釋掉代碼行時,錯誤消失了,但是我仍然非常希望能夠使用該功能並跟蹤分析。 這是整個功能:
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
}
我似乎找不到任何與此錯誤相關的信息。 如果有人有見識,我將不勝感激!
從Xcode 6 beta 7開始,當您要調用application:didFinishLaunchingWithOptions:
,必須替換:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
/* ... */
}
使用以下代碼:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
/* ... */
}
此方法的最后一個參數不再是NSDictionary,而是[NSObject: AnyObject]?
類型的Dictionary [NSObject: AnyObject]?
。 因此,您必須更新代碼(包括您的trackAppOpenedWithLaunchOptions:
參數類型)。
launchOptions
參數應聲明為NSDictionary!
而不是AnyObject!
:
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
// ...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.