//Seperate into arrays
NSString *NumberItems = [RawMessage componentsSeparatedByString:@"|"];
//Create the strings
NSString *number1 = [NumberItems objectAtIndex:0];
NSString *number2 = [NumberItems objectAtIndex:1];
NSString *number3 = [NumberItems objectAtIndex:2];
NSString *number4 = [NumberItems objectAtIndex:3];
NSString *number5 = [NumberItems objectAtIndex:4];
NSString *number6 = [NumberItems objectAtIndex:5];
NSString *number7 = [NumberItems objectAtIndex:6];
NSString *number8 = [NumberItems objectAtIndex:7];
NSString *number9 = [NumberItems objectAtIndex:8];
NSString *number10 = [NumberItems objectAtIndex:9];
NSString *message = [NumberItems objectAtIndex:10];
字符串RawMessage包含此内容,
011597464952 | 01521545545 | 454545474 | 454545444 | 01521545545 | 454545474 | 454545444 | 01521545545 | 454545474 | 454545444 | Hello world我是消息
应用程序似乎在那之后堵塞了?我需要在最后和/或RawMessage
发布NumberItems答案 0 :(得分:3)
componentsSeparatedByString返回一个NSArray - 您需要执行以下操作:
NSArray *NumberItems = [RawMessage componentsSeparatedByString:@"|"];
那应该解决它。
答案 1 :(得分:1)
第一行应该是:
NSArray *NumberItems = [RawMessage componentsSeparatedByString:@"|"];