0

I'm developing for iOS 6.1 and I am learning Core Data.

Things seem to be working reasonably up until I try to write data out.

Some code begin ---

next_ID = (NextID *) [NSEntityDescription insertNewObjectForEntityForName: @"NextID" inManagedObjectContext: context];

next_ID.recName = @"Index";

NSLog( @"recName = %@", next_ID.recName );  // <-- looks good

NSError __autoreleasing *err;
BOOL success;

if (!(success = [context save: &err]))
   NSLog(@"Error saving context: %@", err.localizedFailureReason);
else NSLog( @"save DB successful!" );

Some code end ---

I get to the 'save DB successful message fine. But, when I open a terminal window and go to the documents area and do an 'sqlite3 NextID.sqlite .dump', I do not see my "Index" string in the dump.

In fact, what I see in the dump looks the same whether or not I do the next_ID.recName = @"Index"; and save steps.

So, I think it is not updating but I'm baffled as to what to check from here.

4

1 回答 1

0

不知道我的问题是什么。我从头开始重新创建了 xcdatamodeid,并非常仔细地完成了所有工作。然后它起作用了。我写了数据,现在可以在 sqlite3 NextID.sqlite .dump 中看到它。

很抱歉浪费了带宽。

于 2013-09-03T12:50:55.577 回答