我的代码如下:
NSArray *modifyVersionOnDevice [FileHandler parseFile:devicepath];
NSString *param = [modifyVersionOnDevice objectAtIndex:1];
//param at this point is one element with string of "#MAJREV: 3"
//As soon as I run the next line, I get an error Unrecognized selector sent
to instance.
NSArray *d =[param componentsSeparatedByString:@":"];
如果我进行硬编码
NSString *param =@"#MAJREV: 3"; it works
答案 0 :(得分:-4)
原来,您必须将param转换为文字字符串。
NSString *param = [NSString stringWithFormat:@"%@",[modifyVersionOnDevice objectAtIndex:1]];
然后 NSArray * d = [param componentsSeparatedByString:@“:”];