Restkit 0.20RestKit 0.20 - 預計內容類型(空)
有誰知道我爲什麼每次調用都會得到這個輸出?任何關於追蹤它的建議?我可以在調試輸出中看到json有效載荷。
error=Error Domain=AFNetworkingErrorDomain Code=-1016 "Expected content type (null), got application/json" UserInfo=0x9187fe0 {NSLocalizedRecoverySuggestion={
我作出上述呼籲是
[manager getObjectsAtPath:@"/customers" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSArray* statuses = [mappingResult array];
NSLog(@"Loaded customers: %@", statuses);
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
NSLog(@"Customer Error: %@", error);
}];
和我的映射代碼是
@interface DataCustomers : NSObject
@property (nonatomic, copy) NSString* customerid;
@property (nonatomic, copy) NSString* firstname;
@property (nonatomic, copy) NSString* lastname;
@property (nonatomic, copy) NSString* email;
@end
RKObjectMapping *map = [RKObjectMapping mappingForClass:[DataCustomers class]];
[map addAttributeMappingsFromDictionary:@{
@"id" : @"customerid",
@"firstname" : @"firstname",
@"lastname" : @"lastname",
@"email" : @"email"}];
[manager addResponseDescriptor: [RKResponseDescriptor responseDescriptorWithMapping:map
pathPattern:@"/customers"
keyPath:@"customers"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)]];
似乎是某處的圖書館衝突。完全相同的代碼在新項目中沒有此錯誤。很奇怪。 – darren