我正在尝试将 NSString 值传递给 char 类型变量,但我收到此错误 -
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString charValue]: unrecognized selector sent to instance 0x1f8dce60'
*** First throw call stack:
(0x357ae56b 0x35a8e97f 0x357b24fb 0x357b0c0d 0x35702e68 0x3d233 0x379d1 0x31cd2ead 0x3633accb 0x37235 0x39851 0x370c1 0x36c33 0x331eb 0x363575b5 0x362a8991 0x362a88ad 0x31c11acf 0x31c111bb 0x31c39323 0x356f52e1 0x31c39783 0x31b9dc65 0x3577f143 0x3577e9a9 0x3577d6ef 0x356fbc1d 0x356fbaa9 0x385bf33b 0x36865535 0x26ffd 0x344c6b20)
libc++abi.dylib: terminate called throwing an exception
我像这样在他们的 h 文件中声明它
char storageChar;
//..
@property (assign) char storageIcon;
然后在 m 我从 NSDictionary 条目中调用一个字符串并尝试将它传递给这样的字符
// initalize storageChar - char
storageChar = [[tempDict valueForKey:@"STORAGE"] charValue];
一旦线程运行此应用程序崩溃,有人可以告诉我我做错了什么,因为在构建过程中没有警告或错误...