发送到实例的无法识别的选择器仅发生在 iOS 12
unrecognized selector sent to instance happening on iOS 12 only
我有一个奇怪的问题,即以下错误仅发生在一台仅 iOS 12 版本的设备上。为什么这只发生在这个 OS 而不是其他人?
错误
Fatal Exception: NSInvalidArgumentException
-[NSTaggedPointerString stringValue]: unrecognized selector sent to instance 0xe4d38ae23d3589b7
JSON
"Name": "A",
"Teams": [
{
"Number": "3",
代码
poolTeam.number = [NSString stringWithFormat:@"%@%@", [poolJson objectForKey:@"Name"], [[teamJson objectForKey:@"Number"] stringValue]];
下面是将响应转换为 JSON
的代码
- (id)parseResponse {
@try
{
NSError *error = nil;
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
return jsonDict;
}
@catch(NSException *ex) {
return nil;
}
}
如果您在 NSString 上使用 [stringValue],则此错误仅在 iOS 12.x 时发生。删除多余的转换以修复。
我有一个奇怪的问题,即以下错误仅发生在一台仅 iOS 12 版本的设备上。为什么这只发生在这个 OS 而不是其他人?
错误
Fatal Exception: NSInvalidArgumentException
-[NSTaggedPointerString stringValue]: unrecognized selector sent to instance 0xe4d38ae23d3589b7
JSON
"Name": "A",
"Teams": [
{
"Number": "3",
代码
poolTeam.number = [NSString stringWithFormat:@"%@%@", [poolJson objectForKey:@"Name"], [[teamJson objectForKey:@"Number"] stringValue]];
下面是将响应转换为 JSON
的代码- (id)parseResponse {
@try
{
NSError *error = nil;
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
return jsonDict;
}
@catch(NSException *ex) {
return nil;
}
}
如果您在 NSString 上使用 [stringValue],则此错误仅在 iOS 12.x 时发生。删除多余的转换以修复。