Debugging SIGABRT within NSManagedObjectContext -save: - iphone

From inside NSManagedObjectContext -save: I am getting this message:
Assertion failed: (_Unwind_SjLj_Resume() can't return), function _Unwind_SjLj_Resume, file /SourceCache/libunwind/libunwind-24.1/src/Unwind-sjlj.c, line 326.
Program received signal: “SIGABRT”.
warning: Unable to read symbols for
/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1
(8C148)/Symbols/Developer/usr/lib/libXcodeDebuggerSupport.dylib
(file not found).
This happens when I delete an Experiment object with to-many with Run which has to-many with Sample which has to-one with Data. Experiment also has to-many with Page which has to-many with Display which has to-many to Run. I mention this to point out the cyclical nature of the graph. Here is a simplified graph of model:
An Experiment a top level entity with which the user interacts. An Experiment contains multiple Run objects. A Run is a collection of data starting at a particular time and ending at a later time. Since data can be collected from multiple sources simultaneously, there is a Sample for each source for each Run. An Experiment contains data and this data needs to be viewed and interacted with. So, each Experiment has some number of Page objects and each Page contains some number of Displays (e.g., graphs, meters). A Display is configured to display some subset of the Runs that belong to the Experiment. So, while an Experiment may contains dozens of Runs, one of its Pages will only display a few of those Runs at a time. The Display entity maintains this list. A Display is not a view. A view will reference a Display object and be notified of changes to the Display object.
I had been using Delete Rules but have now switched to "No Action" delete rules in combination with -prepareForDeletion methods for all of these classes. This change made no difference. In both cases, the error message is the same.
Interestingly, when I relaunch the app, all the objects that were marked for deletion have been deleted.
Also, if an Experiment has no Run objects, then deletion works without incidence. For that matter, deleting a single Run from an Experiment also works.
I am hoping that someone has seen something like this and can offer advice on what would cause this. Or, if someone has advice on how to get libXcodeDebuggerSupport.dylib for iOS 4.2.1, that might also be helpful.
Update: I followed advice found here and was able to get Xcode to find libXcodeDebuggerSupport.dylib for iOS 4.2.1. But this did not help at all in diagnosing problem - which persists.
Update 2: After reading a bit and downloading a version of unwind-sjlj.c, it seems that I am dealing with something like an uncaught exception. I am not sure how this helps me...
Update 3: Thanks to Kamchatka, I did something I probably should have done a few days ago: turned on "Stop on Objective-C Exceptions". This allowed me to see that a reference to a deleted object was still being held - and, worse, was key-value observing the deleted object. Fixing this fixed problem and I was able to revert to using delete rules rather than -prepareForDeletion methods.

You should try to activate "Run > Stop on Objective-C exception". It allowed me to find the place where there was an access to an object turned into fault which was the root cause of the problem.

Related

Opshub migration failures

I'm migrating a large amount of projects from a on premise tfs2010 to vso, nearly all of them was able to migrate without any problems, but a few are creating errors. I am using Opshub Integration Manager Framework-OVSMU-V1.2.0.000.
1.
OH-TFS-Connector-0054: Test Step Id cannot be empty and It must be a valid number. Please check the Mapping and add valid mapping for the Test Step Id.
The most common error. This error is also described in opshub-visual-studio-online-migration-utility-test-cases-failing, but has yet to receive an accepted answer. As mentioned in this post the cause if the problem might be Shared Steps, so I tried removing one from a test case, and that made it pass in the migration utility. Unfortunately I need those test cases and it is not feasible for me to just delete them.
2.
OH-TFS-Connector-0051: Operation failed getCollectionMetaData. Server Error : TF201063: Adding a Test Case link to work item 18374 would result in a circular relationship. To create this link, evaluate the existing links, and remove one of the other links in the cycle.
After inspecting the Work Items that causes the error and concluding that there is no links, and no clear circular reference, not even a Shared Step linking to work item 18374. Upon further inspection I noticed that work item 18374 doesn't even exist.
Any help would be much appreciated.
OH-TFS-Connector-0054: Test Step Id cannot be empty and It must be a valid number. Please check the Mapping and add valid mapping for the Test Step Id.
This issue is addressed in latest release of OVSMU (1.3.0.000). You can download from
https://visualstudiogallery.msdn.microsoft.com/28a90a17-d00c-4660-b7ae-42d58315ccf2
OH-TFS-Connector-0051: Operation failed getCollectionMetaData. Server Error : TF201063: Adding a Test Case link to work item 18374 would result in a circular relationship.
This issue is scheduled for next release which will be out shortly. Check Visual Studio Gallery for further updates.
Thanks.

Core Data Error

I am creating an application using Core Data. But When I run my app it crashes. It shows me this reason:
reason = "The model used to open the store is incompatible with the one used to create the store";
What should I do now?
I think you need to refer this link and refer to answer given by Grouchal in the link below:
What do I have to do to get Core Data to automatically migrate models?
If you need any further help please do let me know.
Hope this helps you.
It means that you created a model, run the app, modified the model (by adding or removing managed objects, renaming object properties and so on...) and reopened the app without migrating the data first. I still have to try this by myself but, you should definitely take a look here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreDataVersioning/Introduction/Introduction.html
You can just delete the app (icon) from the simulator or device. Then, rebuild and run.
As dave explained, you have modified the core data structure (the store). If you're using the standard template, in the new rebuild a new model (NSManagedObjectModel) will be created that is compatible with your newly modified store.
You will probably be making many changes to the core data structure (adding or deleting an entity or some property or relationship), and, each time you do, you can just delete the app from the simulator or device.

XCode debugger not helping find device-only issue

So, I have an iOS tabbed app (live and free in the store [http://itunes.com/apps/iphoundyou]). One tab is a grouped tableview, with the number of groups (1 or 2) dependent on some JSON that a web service returns. The JSON is valid and straightforward. Handling it seems to be easy, and, when run in the simulator, behaves as expected. However, I just found that when run on the device, if the two section reaction is needed...it crashes.
"ok" I thought "I'll just hook up my device, launch the debugger, replicate the crash, and figure out where I have a bug"
However, when I did that, I get the most unhelpful response I could expect:
So, given that it works in the simulator, is there any suggestions as to how else to track down the flaw? The code for the tableview is nothing special, along the lines of "if this JSON key exists, number of sections=2...with the number of rows of that section equal to the number of items in another array within the JSON"
Another note: I recently started seeing a dozen or so of these when launching an app:
unable to read unknown load command 0x25
unable to read unknown load command 0x26
Thanks so much.
In my case it turned out that it was just my own error: I'd updated my device OS but didn't have that SDK (I was behind in updating XCode)

iphone core data app crash

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???
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.
8.2 has become more strict on the location (and permissions) of your persistent store. I've just seen the "513" error appear when the database was stored in the bundle and used with a read only option. Using a device with 8.1 it worked without failing, but on 8.2 the error and exception appeared causing a crash. On the simulator the exception did not occur and happily continued to work.
The solution that worked to copy the database into the application documents directory at start up.
NSFileManager copyItemAtURL:toURL:error will come in useful.

How to debug 'no entities specified' when working with ZSync and CoreData Syncing

I'm trying to get ZSync to work between a desktop and iPhone app. I've got my schemas set up and all info matches between my MOM and my schema so I should be good to go. When I initiate my sync, however, I get this error.
|Miscellaneous|Error| SyncServices
precondition failure in [ISyncSession
_validateClient:entityNames:beforeDate:clientHasTruthForEntityNames:target:selector:]:
no entities specified
Anyone know what this means, and how to debug it?
I'm a novice with this SyncServices stuff.
Cheers!
Update
Ok, I've got it showing in syncrospector, but still getting the unrecognized error.
What do you mean by my clientdescription at the Daemon is wrong?
Thanks.
Update
Alright, I had the clientDescription working , but now when this fires:
ZAssert([[ISyncManager sharedManager]
registerSchemaWithBundlePath:path],
#"Failed to register sync schema");
I get this error :(
[NOTE: this exception originated in
the server.]
*** -[NSCFArray insertObject:atIndex:]: attempt to
insert nil
This is an issue in your Sync Services settings. It means that you have not declared what entities need to be synced. I suggest comparing your SyncSchema subproject (for your desktop app side) to the one included in the SampleDesktop project.
update
I checked all that, to no avail. I am using a versioned mom, would that make a difference? In my ManagedObjectModels, should I use the name of the version or the collection? (mom or momd?) Thanks, I'm almost there!
No, the schema should point to your latest model. Are you certain that it is pointing to it correctly? That can be one of the trickiest bits. Are you including the model in the schema bundle or are you making a reference to it?
update
First, please put these updates into your question, the comment section is really not meant for them.
Alright, got past this problem. Syncing starts now I get "failed to register client because: client named Xmac wants to sync unrecognized entity named: X.Entity" This happens with all my entities, sadly.
This error means that your sync schema is still not completely valid. Does your desktop client sync?
Can you see its data in the syncrospector?
If so then your clientdescription at the Daemon is wrong. If it doesn't sync then solve that first as it sounds like your SyncSchema bundle is still incorrect. I suggest trying to compare it against the sampleDesktop application that is included in the project.
update Syncrospector
Ok, I've got it showing in syncrospector, but still getting the unrecognized error. What do you mean by my clientdescription at the Daemon is wrong? Thanks.
In the syncrospector I am guessing that you are seeing all of your entities and data?
On the Daemon, there is a clientDescription.plist. This plist describes what data that the Daemon is going to sync with. That plist needs to be updated (since the default one refers to the sample app, etc.) to reference your data structures just like your desktop application does.
In the very near future, this piece will be moved to a plugin so that you are not modifying the daemon directly. Expect to see updates on the project itself during the next couple of weeks. But for now, (and will be reusable), modify the plist inside of the daemon and you should be ready to sync.
update ZAssert
That line unwinds into:
BOOL success = [[ISyncManager sharedManager] registerSchemaWithBundlePath:path];
NSAssert(success, #"Failed to register sync schema");
A few things can cause this:
Your path is nil, check that in the debugger
There is something wrong with your sync schema.
What other debug comments are you seeing?