我在嘗試使用此如何比較NSPersistentStoreUbiquitousTransitionType枚舉值
// Check type of transition
if let type = n.userInfo?[NSPersistentStoreUbiquitousTransitionTypeKey] as? UInt {
FLOG(" transition type is \(type)")
if (type == NSPersistentStoreUbiquitousTransitionType.InitialImportCompleted) {
FLOG(" transition type is NSPersistentStoreUbiquitousTransitionTypeInitialImportCompleted")
}
}
比較從NSPersistentStoreCoordinatorStoresDidChangeNotification
接收的值時,下面的錯誤,但我得到以下編譯器錯誤
NSPersistentStoreUbiquitousTransitionType is not convertible to UInt
當我以爲我得到了斯威夫特的喋喋不休,我再次陷入困境!
謝謝,所以我正確地將userInfo的值作爲Uint獲取,還是有更好的方式來處理不需要獲取原始值的事情? – 2014-10-07 06:30:23
更新了我的答案 – 2014-10-07 14:25:03