RestKit崩溃: - [RKResponseError copyWithZone:]:发送到实例的无法识别的选择器

时间:2014-01-13 14:49:15

标签: ios objective-c restkit

当我执行相同的请求但响应很好时,应用程序不会崩溃,但是当响应错误时,它会崩溃:

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

可能是什么问题?

1 个答案:

答案 0 :(得分:2)

问题是我在RKResponseError属性上写了副本:

@property (copy, nonatomic) RKResponseError *responseError;

应该是:

@property (nonatomic) RKResponseError *responseError;

已修复;)