gpt4 book ai didi

ios - [NSConcreteValue rangeOfString :]: unrecognized selector sent to instance

转载 作者:行者123 更新时间:2023-11-29 01:07:26 29 4
gpt4 key购买 nike

我尝试从字符串中获取范围,例如:

NSString *str  = change[@"new"];
NSLog(@"%@",str);// it will be printed

NSRange range = [str rangeOfString:@"NSPoint"];//the exception uncaughted
NSLog(@"%lu",range.location);

但后来我遇到了一个异常(exception):

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSConcreteValue rangeOfString:]: unrecognized selector sent to instance 0x7fc258c4f8f0'

令我困惑的是,如果我将 str 更改为 @"NSPoint: {0, 0}"会有效果吗?!天哪,为什么?

最佳答案

尝试

NSString *str  = [NSString stringWithFormat:@"%@",change[@"new"]];

代替

NSString *str  = change[@"new"];

关于ios - [NSConcreteValue rangeOfString :]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36175887/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com