VahidGR VahidGR - 10 months ago 38
Swift Question

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

I'm working with core data to save data from my users, I'm following a tutorial with Swift 3 It works perfectly fine on the tutorial and actually the code works on my Xcode too but it does show some errors!
Here is an image of my code and the errors

Full error:


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


And the the other error:


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


Images of my core data entities

Ask anything if the info is not complete

Answer Source

Replace your line:

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

With:

var newUser = UserInfoEntity(entity: UserEntity!, insertInto: self.appDelegate.coreDataStack.managedObjectContext)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download