2017-08-17 102 views
0

我正在使用核心數據來保存來自我的用戶的數據,我使用Swift 3學習了一個教程它對於教程,實際上代碼也可以在我的Xcode上運行,但它確實顯示了一些錯誤! Here is an image of my code and the errors無法將類型'UserInfoEntity!.Type'的值轉換爲期望的參數類型'NSEntityDescription'

完整的錯誤:

Cannot convert value of type 'UserInfoEntity!.Type' to expected argument type 'NSEntityDescription'

而其他錯誤:

Cannot call value of non-function type 'NSEntityDescription?'

Images of my core data entities

可以問任何問題,如果信息是不完整的

回答

0

替換您行:

var newUser = UserInfoEntity(entity: UserInfoEntity!, insertInto: self.appDelegate.coreDataStack.managedObjectContext) 

有了:

var newUser = UserInfoEntity(entity: UserEntity!, insertInto: self.appDelegate.coreDataStack.managedObjectContext) 
0

啊,你」重新傳遞「UserInfoEntity」c lass類型而不是該類的對象 - 第5行代碼。建議:將變量保持爲小寫。

相關問題