Ios RestKit错误“;无法将键路径处的值转换为类型';NSString";

Ios RestKit错误“;无法将键路径处的值转换为类型';NSString";,ios,restkit,foursquare,Ios,Restkit,Foursquare,我是iOS新手,我正在尝试映射Foursquare Explore API,我不断得到以下错误 E restkit.object_mapping:RKMappingOperation.m:440 Failed transformation of value at keyPath 'name' to representation of type 'NSString': Error Domain=org.restkit.RKValueTransformers.ErrorDomain Code=300

我是iOS新手,我正在尝试映射Foursquare Explore API,我不断得到以下错误

E restkit.object_mapping:RKMappingOperation.m:440 Failed transformation of value at keyPath 'name' to representation of type 'NSString': Error Domain=org.restkit.RKValueTransformers.ErrorDomain Code=3002 "Failed transformation of value '(
"Jenkinson's Pavilion",
"The Spot Pizza Grill",
"The Ark Pub & Eatery",
"Jenkinson's Inlet Bar",
"Outside the Box Patio Bar",
"The Off Shore"
)' to NSString: none of the 2 value transformers consulted were successful." UserInfo=0x14Righd3b500 {detailedErrors=(
"Error Domain=org.restkit.RKValueTransformers.ErrorDomain Code=3002 \"The given value is not already an instance of 'NSString'\" UserInfo=0x14d26ab0 {NSLocalizedDescription=The given value is not already an instance of 'NSString'} "Error Domain=org.restkit.RKValueTransformers.ErrorDomain Code=3000 \"Expected an `inputValue` of type `NSNull`, but got a `__NSArrayI`.\" UserInfo=0x14d73060 {NSLocalizedDescription=Expected an `inputValue` of type `NSNull`, but got a `__NSArrayI`.}"
这是我的密码:

- (void)configureRestKit
{
// initialize AFNetworking HTTPClient
NSURL *baseURL = [NSURL URLWithString:@"https://api.foursquare.com"];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:baseURL];

// initialize RestKit
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];

// setup object mappings
RKObjectMapping *venueMapping = [RKObjectMapping mappingForClass:[Venue class]];
[venueMapping addAttributeMappingsFromDictionary:@{@"name": @"venueName"}];

// register mappings with the provider using a response descriptor
RKResponseDescriptor *responseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:venueMapping
                                             method:RKRequestMethodGET
                                        pathPattern:@"/v2/venues/explore"
                                            keyPath:@"response.groups.items.venue"
                                        statusCodes:[NSIndexSet indexSetWithIndex:200]];

[objectManager addResponseDescriptor:responseDescriptor];
}

现在我正试图映射“名称”,我做错了什么?

您的
响应、组、项、场地的关键路径钻得太深,因为
是一个数组,然后
也是一个数组。钻取到第一个数组并在该级别进行映射很好。但是,当您钻取到下一个数组级别时,您将永远试图将数组转换为单个目标对象。这就是为什么您会在日志输出中看到名称数组

因此,您需要在不同的级别进行备份和映射,通常使用容器对象,并可能将部分关键路径移动到映射而不是描述符