Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS core data corruption?

This is a rather general question, as I don't have any solid evidence atm.

I have an iPhone app with about 20,000 users. It allows users to message each other, and saves those messages in core data. The only other thing it saves in core data is the users profile, a copy locally and a copy on the server.

I have a small percentage of users complaining that they receive messages but nothing shows, when they send a message (which immediately goes into core data then shows on screen) it disappears immediately. Nothing but a full restore seems to fix it, and from what I can gather, even a restore which involves them restoring a backup they just made doesn't fix it.

My first thought was that core data must have become corrupted in some way ... but the messages they attempt to send actually do send, and this would be impossible if their local profile had become corrupted too.

I've never been able to recreate it, or found anyone face to face who has had a similar problem.

Does anyone have any suggestions on what could occur in core data that could lead to a situation like this so I can start to try and track down the problem? I'd estimate it's happening with about 1% of users.

Once again, sorry for the generality of the question, but it's all I have to work with just now!

Thanks

** Edit

Just to clarify, deleting the app and reinstalling it, does not fix the problem when this happens.

** Edit

I just had some more information from a user who is suffering from the problem ... the information my app saved in core data still exists after the app has been deleted and re-installed, all of it. I have deleted and re-installed my app hundreds of times over the last year, on countless different devices, and every time I delete and re-install, all previous data stored in core data is completely erased .. yet for these users, this is not happening. Does this sound like an iPhone issue that basically requires a restore?

** Edit 03/12/2010

AT LAST! I have some real solid information to work on. I added flurry to my latest release so I could track any core data error messages, and was able to correlate the errors received with a user id that I knew for a fact was experiencing the problem ...

The error is: "Msg: Error Domain=NSCocoaErrorDomain Code=133020 'The operation couldn’t be completed. (Cocoa error 133020.)' UserInfo=0x39c7c0 {conflictList=( 'NSMergeConflict (0x39c700) for NSManagedObject (0x38ad00) with objectID '0x375c30

Unfortunately, the error is trimmed. Flurry must have limit on the size of the message it can pass.

I don't have access to my mac and code just now, I'll start investigating as soon as I do and post back with some source code and any findings I have.

like image 843
Steven Elliott Avatar asked Jun 19 '26 03:06

Steven Elliott


1 Answers

I'm having a problem like that right now. So far I have figured out that the same object is modified in two NSManagedObjectContext-s. The object X has (at least) two persistent attribites, a and b, one thread changes a, another thread changes b, and CoreData cannot merge.

The key phrase in the error message is NSMergeConflict:

Error Domain=NSCocoaErrorDomain Code=133020 "The operation couldn’t be completed. (Cocoa error 133020.)" UserInfo=0x1544c7d0 {conflictList=( "NSMergeConflict (0xc489f40) for NSManagedObject (0xd833ca0) with objectID '0xd82b7c...

Not sure this really helps, but at least it tells you what might go wrong...

like image 64
18446744073709551615 Avatar answered Jun 20 '26 16:06

18446744073709551615



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!