NSObject(NSObject)doesNotRecognizeSelector:崩溃
NSObject(NSObject) doesNotRecognizeSelector: crash
崩溃报告:
0 CoreFoundation!__exceptionPreprocess + 0x7c
1 libobjc.A.dylib!objc_exception_throw + 0x34
2 CoreFoundation!-[NSObject(NSObject) doesNotRecognizeSelector:] + 0xd0
3 CoreFoundation!___forwarding___ + 0x364[enter image description here][1]
4 CoreFoundation!_CF_forwarding_prep_0 + 0x58
5 yyfe!__70-[InvestModel getOpenAccountRewardWithPhoneNum:identifyCode:complete:]_block_invoke [InvestModel.m : 104 + 0x4]
6 libdispatch.dylib!_dispatch_call_block_and_release + 0x14
7 libdispatch.dylib!_dispatch_client_callout + 0xc
8 libdispatch.dylib!_dispatch_main_queue_callback_4CF + 0x730
9 CoreFoundation!__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 0x8
我的代码:
NSDictionary* data = returnDict[@"data"];
NSInteger respStatus = [data[@"respStatus"] integerValue];
if ([data[@"code"] isEqual: @(1)] && respStatus == 6) {
[weakSelf saveSuccessGetOpenAccountReward];
callback(YES,[data[@"rank"] integerValue],[data[@"amount"] integerValue],getRewardSuccess);
return;
}
和回调类型:
typedef void(^GetRewardCallBack)(BOOL,NSInteger,NSInteger,GetRewardMessageType);
104 行是 callback(),returnDict 有 "rank" 和 "amount" 的值,我不确定 callback = nil 是否会导致崩溃,但 callback 不能等于 nil,知道吗?
搞清楚!服务器返回的 data[@"rank"] 既不是 NSString 也不是 NSNumber。所以它无法识别@selector(integerValue)
崩溃报告:
0 CoreFoundation!__exceptionPreprocess + 0x7c
1 libobjc.A.dylib!objc_exception_throw + 0x34
2 CoreFoundation!-[NSObject(NSObject) doesNotRecognizeSelector:] + 0xd0
3 CoreFoundation!___forwarding___ + 0x364[enter image description here][1]
4 CoreFoundation!_CF_forwarding_prep_0 + 0x58
5 yyfe!__70-[InvestModel getOpenAccountRewardWithPhoneNum:identifyCode:complete:]_block_invoke [InvestModel.m : 104 + 0x4]
6 libdispatch.dylib!_dispatch_call_block_and_release + 0x14
7 libdispatch.dylib!_dispatch_client_callout + 0xc
8 libdispatch.dylib!_dispatch_main_queue_callback_4CF + 0x730
9 CoreFoundation!__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 0x8
我的代码:
NSDictionary* data = returnDict[@"data"];
NSInteger respStatus = [data[@"respStatus"] integerValue];
if ([data[@"code"] isEqual: @(1)] && respStatus == 6) {
[weakSelf saveSuccessGetOpenAccountReward];
callback(YES,[data[@"rank"] integerValue],[data[@"amount"] integerValue],getRewardSuccess);
return;
}
和回调类型:
typedef void(^GetRewardCallBack)(BOOL,NSInteger,NSInteger,GetRewardMessageType);
104 行是 callback(),returnDict 有 "rank" 和 "amount" 的值,我不确定 callback = nil 是否会导致崩溃,但 callback 不能等于 nil,知道吗?
搞清楚!服务器返回的 data[@"rank"] 既不是 NSString 也不是 NSNumber。所以它无法识别@selector(integerValue)