开发者

Core Data - insertNewObjectForEntityForName debug

开发者 https://www.devze.com 2023-01-01 12:52 出处:网络
I\'m trying to figure out why insertNewObjectForEntityForName is not working. I assume it\'s something to do with my data model but can\'t be sure. Xcode does not report any errors nor does it crash.

I'm trying to figure out why insertNewObjectForEntityForName is not working. I assume it's something to do with my data model but can't be sure. Xcode does not report any errors nor does it crash. All I get is the first log statement output to the console.

NSLog(@"Get here...");
Task *task = (Task *)[NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:insertionContext];
NSLog(@"but never get here...");

Any suggestions as to how I can work out what the pr开发者_Python百科oblem is?


I assume an exception occurs in line 2. Try the following

@try
{
    NSLog(@"Get here...");
    Task *task = (Task *)[NSEntityDescription insertNewObjectForEntityForName:@"Task" inManagedObjectContext:insertionContext];
    NSLog(@"but never get here...");
}
@catch (NSException * e)
{
    NSLog(@"Exception: %@", e);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号