I already create a new entity and save it. Then I want to grab last insert id from first entity then save it into second entity as a reference id.
let appDel: AppDelegate = (UIApplication.sharedApplication().delegate as AppDelegate)
let userContext: NSManagedObjectContext = appDel.managedObjectContext!
let userEn = NSEntityDescription.entityForName("UserEntity", inManagedObjectContext: userContext)
var newUser = Users(entity: userEn!, insertIntoManagedObjectContext: userContext)
newUser.uname = "Nurdin"
userContext.save(nil)
Then how to save last insert id into NSUserDefault? Because I want to predicate with existing data inside CoreData for matching purpose.
Please advice. Thank you.