ios - How to make NSManagedObject not fault? -


i'm debugging big project written developer. project uses coredata new to. i'm having crash happens due fact nsmanagedobject being fault(i have poor understanding of fault is) , convert object "not fault" , see if helps. reading documentation made me think to make object not fault equal to fire fault (again have poor understanding of "to fire"), decided fire calling method on it, , method haschanges since it's not in list of methods don't fire fault. after calling method object still remained being fault. can give me example of how convert nsmanagedobject "not fault" state?

the exception mentioned in comment is:

terminating app due uncaught exception 'nsobjectinaccessibleexception', reason: 'coredata not fulfill fault '0x1f0627a0 <x-coredata://e40418a0-a8e5-4340-865f-a9da2e0095dd/coreobject/p288>'' 

the "could not fulfill fault" message indicates not problem firing fault. in fact there no special steps fire fault-- access attributes, , if necessary, fault fires automatically.

what error telling you're doing causes fault fire, core data can't find record of instance you're using. can happen in scenarios, example:

  1. fetch object, , leave fault (i.e. don't access attributes)
  2. delete core data, keep reference object (maybe in instance variable)
  3. save changes
  4. try access attribute on object fetched in step 1.

at point core data use object attribute value. deleted it, attribute data gone. core data throws exception.

there other scenarios can trigger this-- calling reset on managed object context while keeping fetched objects around, or removing persistent store (so data still exists in store file, file isn't loaded anymore). in general means core data trying data on object that's no longer valid.

what need do:

  • figure out object causing this. setting exception breakpoint, debugger loads crash happening, idea.
  • get rid of object. preventing fault firing might prevent specific crash, long still have object, it's land mine in app. explode , crash app touch it.
  • figure out why have invalid managed objects lurking in memory. maybe should have gotten rid of them earlier? maybe you're accidentally deleting don't want delete? reason you're keeping managed objects around when they're no longer valid. core problem that's causing trouble.

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -