سؤال

I'm updating RestKit from 0.10 to 0.20 and getting some errors I'm trying to figure out.

I'm getting errors on the Spring.m file for the MappingForClass:usingBlock, no @interface for mapKeyPathsToAttributes, and no @interface for hasMany:withMapping.

Can't seem to figure this out myself.

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

I'm using https://github.com/RestKit/RestKit/wiki/Upgrading-from-v0.10.x-to-v0.20.0 to help me try to figure this out.

هل كانت مفيدة؟

المحلول

Answer: Needed to use RKRequestDescriptor

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top