Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sergio10

macrumors regular
Original poster
Oct 3, 2007
137
0
Hi,

According to string I'd like to create new string but it crashes:
PHP:
- (NSString*)test
{
	switch (self.type) 
	{
		case SHIPMENT_LIST_XML:
		{
			NSString *xml = [[NSString alloc] initWithString:[parser nodeValue:PARAM_1]];
			
			if(xml == nil)
			{
				return nil;
			}
			else
			{
				[parser deleteNode:PARAM_1];
				
				return xml;
			}
		} break;
	}
	return nil;
}
Do I create xml value correctly?

Thank you,
Serhiy Otroshchenko
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
i believe switch statements can only receive integers as arguments.
No, they can be simple constants or constant expressions. The problem is the OP's code snippet is too vague to draw any conclusions about things like this and therefore very hard to diagnose why it doesn't work. That's why I asked for more specifics.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.