I am work on a simple program in which I split a string and a user global, I use the following code for splitting the string.
NSString *GlobleStr;//globale variable
//===============
NSString *xmlParsingResult=@"Apple,iphone";
NSArray *array = [xmlParsingResult componentsSeparatedByString:@","];
NSString *StrResult = [NSString stringWithFormat:@"%@", [array objectAtIndex:0]];
GlobleStr =[NSString stringWithFormat:@"%@",[array objectAtIndex:1]];
NSLog(@"cmd %@",StrResult);
NSLog(@"value%@",GlobleStr);
my code can split the string and o/p is cmd:Apple value:iphone
but my problem is that as soon as I call another xib then my global variable will be empty or nil and the application will crash ( it throws error like Variable is not cfstring
).
Any suggestions?