|
|
#1 |
|
iOS app crashing while parsing XML in TBXML
I am creating a universal app. The app works fine in simulator (iPhone and iPad). But on the iPhone device it crashes. It works fine on iPad device.I am parsing xml from a ASMX web service. I am using TBXML. I have 8 method calls in my service. So each one returns an XML of class like below "ITMAllCustomerDetails", "ITMAllPhoneNumbers",...etc. So the app crashes sporadically at insertNewObject for either of them..(any of the 8)
Here is my crash log: Code:
Thread 3 name: Dispatch queue: com.apple.root.default-priority Thread 3 Crashed: 0 CoreFoundation 0x3b8b1408 __CFBasicHashAddValue + 1560 1 CoreFoundation 0x3b7db194 CFBasicHashAddValue + 3048 2 CoreFoundation 0x3b7deebc CFSetAddValue + 112 3 CoreData 0x36ea45b0 -[NSManagedObjectContext(_NSInternalAdditions) _insertObjectWithGlobalID:globalID:] + 172 4 CoreData 0x36e9c9bc -[NSManagedObjectContext insertObject:] + 136 5 CoreData 0x36e8c6d2 -[NSManagedObject initWithEntity:insertIntoManagedObjectContext:] + 646 6 CoreData 0x36e78d74 +[NSEntityDescription insertNewObjectForEntityForName:inManagedObjectContext:] + 176 7 XYZ Orders 0x001063c4 -[ITMLoginVC traverseElement:] (ITMLoginVC.m:1587) 8 XYZ Orders 0x00105f16 -[ITMLoginVC traverseElement:] (ITMLoginVC.m:1511) 9 XYZ Orders 0x00103a90 -[ITMLoginVC getAllCustomerValues] (ITMLoginVC.m:951) 10 libdispatch.dylib 0x39b8911c _dispatch_call_block_and_release + 8 11 libdispatch.dylib 0x39b8d95c _dispatch_root_queue_drain + 248 12 libdispatch.dylib 0x39b8dabc _dispatch_worker_thread2 + 80 13 libsystem_c.dylib 0x368f2a0e _pthread_wqthread + 358 14 libsystem_c.dylib 0x368f28a0 start_wqthread + 4 Code:
strPath = @"";//some valid URL path
ttbXML = [TBXML tbxmlWithURL:[NSURL URLWithString:strPath]];
if(ttbXML.rootXMLElement)
{
[self traverseElement:ttbXML.rootXMLElement]; //line 951
}
else
{
NSLog(@"the else at 944");
}
Code:
if (element->firstChild)
[self traverseElement:element->firstChild]; // line 1511
Code:
- (void) traverseElement:(TBXMLElement *)element {
if (!self.managedObjectContext)
{
self.managedObjectContext = self.appDelegate.managedObjectContext;
}
do {
if (element->firstChild)
[self traverseElement:element->firstChild];
........
else if ([[TBXML elementName:element] isEqualToString:@"NCustomerDetails"])
{
NSString *temp=@"";
ITMAllCustomerDetails *allCustDetails =(ITMAllCustomerDetails *)[NSEntityDescription
insertNewObjectForEntityForName:@"ITMAllCustomerDetails"
inManagedObjectContext:self.managedObjectContext]; //line 1587
Last edited by dejo; Jan 29, 2013 at 11:20 AM. Reason: Fixed [code] tags. |
|
|
|
0
|
|
|
#2 |
|
Are you accessing the same moc from multiple threads? I think that's not legal.
What does crash mean? SIGALRT? BAD_ACCESS? WHAT? |
|
|
|
0
|
![]() |
|
| Tags |
| crash, ios, managedobjectcontext, universal, xml-parsing |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 08:38 PM.







Linear Mode
