我正在将RestKit从0.10更新为0.20,并且在尝试弄清楚时会出现一些错误。
我在MappingForClass:usingBlock
的Spring.m文件中遇到错误,mapKeyPathsToAttributes
没有@interface,hasMany:withMapping
没有@interface。
似乎无法自己解决这个问题。
Spring.h
@interface Spring : NSObject
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSNumber *id;
@property (nonatomic, strong) NSArray *leafs;
+ (RKObjectMapping *)mapping;
@end
Spring.m
@implementation Spring
// Creating RestKit object mapping variable, THIS IS WHERE ERRORS OCCUR
+ (RKObjectMapping *)mapping {
RKObjectMapping *objectMapping = [RKObjectMapping mappingForClass:[self class] usingBlock:^(RKObjectMapping *mapping) {
[mapping mapKeyPathsToAttributes:
@"name", @"name",
@"id", @"id",
nil];
[mapping hasMany:@"leafs" withMapping:[Leaf mapping]];
}];
return objectMapping;
}
@end
我使用https://github.com/RestKit/RestKit/wiki/Upgrading-from-v0.10.x-to-v0.20.0来帮助我解决这个问题。
答案 0 :(得分:0)
答案:需要使用RKRequestDescriptor