我正在尝试将遗留C++程序转换为objective-C.该程序需要256个可能的ASCII字符数组(每个字符8位).我正在尝试使用这种NSString方法initWithBytes:length:encoding:.不幸的是,当编码如下所示时,它会崩溃(尽管它会编译).
NSString* charasstring[256];
unsigned char char00;
int temp00;
for (temp00 = 0; temp00 <= 255; ++temp00)
{
char00 = (unsigned char)temp00;
[charasstring[temp00] initWithBytes:&char00 length:1 encoding:NSASCIIStringEncoding];
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么?