First controller
OptiiMobileTaskDetailViewController *taskDetailVC = (OptiiMobileTaskDetailViewController *)segue.destinationViewController;
[taskDetailVC setTask:task];
Second Controller
-(void) setTask:(Task *)task {
_task = task;
}
This code working properly but sometime when we use task object in second VC we got Fault object so is there any other way to pass NSManagedobject between view controllers
+(instancetype) taskWithTaskID:(NSNumber *)taskID {
Task *task = [self getManagedObjectForKey:@"taskID" keyValue:taskID];
if (!task) {
//Create task
task = [[OptiiMobileDataStore sharedInstance] createNewObjectNamed:NSStringFromClass([self class])];
task.taskID = taskID;
[[OptiiMobileDataStore sharedInstance] insertObject:task];
}
return task; }
and get the new copy of data just before it is get default
_task = [Task taskWithTaskID:self.taskID];