当我执行相同的请求但响应良好时,该应用不会崩溃,但是当响应错误时,它将崩溃:
NSDictionary *params = @{ @"phone" : telephone, @"password" : password };
[[RKObjectManager sharedManager] getObjectsAtPath:@"users/login/normal"
parameters:params
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
{
NSLog(@"%@", operation.HTTPRequestOperation.responseString);
}
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"%@", error.localizedDescription);
}];
收到不良响应时,应用程序崩溃并显示:
RestKit crash: -[RKResponseError copyWithZone:]: unrecognized selector sent to instance
可能是什么问题呢?
最佳答案
问题是我在RKResponseError
属性上写了副本:
@property (copy, nonatomic) RKResponseError *responseError;
什么时候应该是:
@property (nonatomic) RKResponseError *responseError;
固定的;)