当我执行相同的请求但响应很好时,应用程序不会崩溃,但是当响应错误时,它会崩溃:
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
可能是什么问题?
答案 0 :(得分:2)
问题是我在RKResponseError
属性上写了副本:
@property (copy, nonatomic) RKResponseError *responseError;
应该是:
@property (nonatomic) RKResponseError *responseError;
已修复;)