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

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 29, 2013, 11:18 AM   #1
RookieAppler
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:
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
The line 951 is
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");
	}
Line 1511 is
Code:
 if (element->firstChild)
            [self traverseElement:element->firstChild]; // line 1511
Line 1587 is:
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
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
PhoneyDeveloper
macrumors 68030
 
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

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

Tags
crash, ios, managedobjectcontext, universal, xml-parsing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
iOS to PHP to XML newtoiphonesdk iPhone/iPad Programming 1 Mar 23, 2014 12:15 AM
TBXML - still used? Tander iPhone/iPad Programming 9 Aug 14, 2013 10:36 AM
sprintf function call in .c file in iOS app crashing. mycompuser iPhone/iPad Programming 4 Jun 26, 2013 11:18 AM
iOS Mail App Crashing When Marking Searched Items thekris1234 iOS 6 0 May 1, 2013 04:24 PM
parsing XML in iphone? hajira iPhone 0 Sep 24, 2012 04:51 AM

Forum Jump

All times are GMT -5. The time now is 03:06 PM.

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

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