Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread Display Modes
Old Jan 29, 2013, 11:18 AM   #1
macrumors member
Join Date: Mar 2012
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:
Thread 3 name:  Dispatch queue:
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
The line 951 is
	strPath = @"";//some valid URL path
	ttbXML = [TBXML tbxmlWithURL:[NSURL URLWithString:strPath]];
		[self traverseElement:ttbXML.rootXMLElement]; //line 951
		NSLog(@"the else at 944");
Line 1511 is
 if (element->firstChild)
            [self traverseElement:element->firstChild]; // line 1511
Line 1587 is:
- (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
																			 inManagedObjectContext:self.managedObjectContext]; //line 1587
I am thinking is there some problem with my managedobjectcontext. I am creating like you see above. If this is not clear and you need more information, please ask. Thanks.

Last edited by dejo; Jan 29, 2013 at 11:20 AM. Reason: Fixed [code] tags.
RookieAppler is offline   0 Reply With Quote
Old Jan 29, 2013, 05:20 PM   #2
macrumors 68020
PhoneyDeveloper's Avatar
Join Date: Sep 2008
Are you accessing the same moc from multiple threads? I think that's not legal.

What does crash mean? SIGALRT? BAD_ACCESS? WHAT?
PhoneyDeveloper is offline   0 Reply With Quote

MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

crash, ios, managedobjectcontext, universal, xml-parsing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 11:29 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013,, LLC