0

Today, my core data suddenly stopped working. You must see this:

Screenshot

So basically I have a Task NSManagedObject, which has a medias to-many relationship.

Originally I was using task.medias.count to get the count of the medias. And it has been working from the beginning.

Since the problem happened, I tried several things.

1) Change to code to a try-catch block:

NSInteger mCount;
@try {
    NSSet *myMedias= task.medias;
    mCount = myMedias.count;  <<<===this is the line that debug stops and value flashes in the variable view as shown in the picture.
}
@catch (NSException *exception) {
    NSLog(@"%@", exception);
    ...
}

But it doesn't work, the debugger still stop at mCount line, and that's what is shown in gif.

2) I look into the .xcdatamodeld file, and I found that medias relationship has accidentally put a minimum of 1 count. I toggled that off(see picture). But problem persists.

Model Editor

3) I am using StackMob as backend. When I turn off the network, the flash stops. It seems that core data is trying to fire the fault but couldn't complete it's job. Or something is preventing it from finishing.

4)The error code was:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'nil is not a valid object ID'

==========

Does anyone here knows what happened and how to solve this?

Lei Zhang
  • 500
  • 4
  • 15
  • 1
    What does the crash error say? – Mundi Mar 24 '14 at 07:06
  • The error code reads: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'nil is not a valid object ID' – Lei Zhang Mar 24 '14 at 15:28
  • 1
    Sounds like StackMob is failing to fullfull the fault. But since StackMob is shutting down very soon, you'd be better off ignoring StackMob problems and instead updating the app to not use StackMob. – Tom Harrington Mar 24 '14 at 16:29
  • Tom: You are right. I am working on AWS since I couldn't find a direct replacement with CoreData supported. Do you have any advice that can share with me regarding the server transition? (We have very limited knowledge on backend: 1 iOS dev + 1 designer). Thanks! – Lei Zhang Mar 24 '14 at 18:39
  • It depends on the app. I had good luck with [Wasabi Sync](http://www.wasabisync.com/) last year. That was client work though, so I haven't used it recently. – Tom Harrington Mar 24 '14 at 21:37

0 Answers0