views:

329

answers:

1

I'm able to complete my iphone app using core data internally. But for the first time when I'm running in simulator or on device its crashing with following error:

2010-03-18 10:55:41.785 CrData[1605:4603] Unresolved error Error Domain=NSCocoaErrorDomain Code=513 UserInfo=0x50448d0 "Operation could not be completed. (Cocoa error 513.)", { NSUnderlyingException = Error validating url for store; }

When I run the app again in simulator or on device, its running perfectly. I'm not able to identify the exact problem. Can some one guide me on how to proceed further???

+1  A: 

You need to unroll the errors and see what is going on. Inside of that error (which you can set a break point on objc_exception_thrown to catch it) is the userInfo dictionary which you can interrogate to see what the underlying errors are.

update

What does your NSPersistentStoreCoordinator creation code look like?

Did you add a break point and do a po [error userInfo] so see if there were any additional errors in the userInfo?

Core Data can and does send you a hierarchy of errors and frequently on a small amount of information is exposed at the top error. Unrolling the errors via the debugger is best to determine the underlying causes.

update

Code error 513 means, write permissions for creating store in core data app failed. But the same piece of code is running well from next time. So, what might be the actual problem is not known to me..... how to proceed here.

Again, what does your persistent store creation code look like? You need to post some code so that I can take a look at it. Otherwise I am just guessing which is no fun.

Marcus S. Zarra
Code error 513 means, write permissions for creating store in core data app failed. But the same piece of code is running well from next time. So, what might be the actual problem is not known to me..... how to proceed here.
Satyam svv
Excellent. I was having the same problem with inserting into a DB in the 'bundle' path, so I was told to copy the file into the 'user' library space. When I did that, I decided to 'move' (i.e., to save memory) -- however, move needs permission to delete -- duh! When I dumped [error UserInfo] that became more apparent to me. Now my copy works as expected!
mobibob