While saving the data am checking whether the data is already exist or not in the entity. Problem here is the above method is not working as expected, when I run the app for ver
First you create a User object in your managed context before calling someEntityExists
so most likely this object will be included in the fetch even if it hasn't been saved yet.
Call someEntityExists
before even creating a new user entity to see if you should proceed or not
func saveUserInfo(detail:[String:Any])-> Bool {
if someEntityExists(id: detail["email"] , entityName: "User", type: "String", fieldName: "email") {
print("Data is already present")
return false
}
//else create and save new user
}