I have bad access issue in core data while insert data in database and I also used @try,@catch block but I can't find any solution for the same. I am stuck for last 3days so please help me for solve this issue or give me any suggestion.
- (BOOL) addSynchedContactsList:(int)aAppContactId :(NSString*)aDevContactId
{
NSManagedObjectContext *context = [[PFCoreDataController sharedCoreDataController] managedObjectContext];
BOOL success = YES;
ContactsListSync *syncContact = (ContactsListSync *)[NSEntityDescription insertNewObjectForEntityForName:ENTITY_CONTACTSLISTSYNC inManagedObjectContext:context];
syncContact.appContactlistId = [NSNumber numberWithInt:aAppContactId];
syncContact.devConatctlistId = aDevContactId;
return success;
}
In this line,
ContactsListSync *syncContact = (ContactsListSync *)[NSEntityDescription insertNewObjectForEntityForName:ENTITY_CONTACTSLISTSYNC inManagedObjectContext:context];
OR
ContactsListSync *syncContact = (ContactsListSync *)[[NSEntityDescription insertNewObjectForEntityForName:ENTITY_CONTACTSLISTSYNC inManagedObjectContext:context] retain];
So Please give me any suggestion or any idea.
Thanks in advance for help.