我在一個簡單的程序中工作,在該程序中我拆分了一個字符串和一個全局用戶,我使用下面的代碼拆分字符串。字符串拆分問題
NSString *GlobleStr;//globale variable
//===============
NSString *[email protected]"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);
我的代碼可以分割字符串和O/P是cmd:蘋果值:iphone
但我的問題是,只要我調用另一個廈門國際銀行,然後我的全局變量將是空的或零和該應用程序將崩潰(它會拋出error like Variable is not cfstring
)。
有什麼建議嗎?
編輯you code formate – 2010-09-20 13:13:05