隨着restkit我試圖讓兩個表的數據視圖(收件箱,發),表視圖控制器相同的它們的功能,但它們指的是不同的Web API。 在每個表視圖控制器我配置和初始化restkit並使得用於獲取INBOX或發送的數據的請求時,根據表 一切工作很好,但只具有特定的表中,僅對於另一錯誤發生Restkit獲得不同的數據有兩個表視圖控制器
,其首先被初始化,E restkit.network:RKObjectRequestOperation.m:213 GET 'http://myhost/sent/' (200 OK/0 objects) [request=0.9469s mapping=0.0000s total=0.9963s]: Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No response descriptors match the response loaded." UserInfo=0x11001a040 {NSLocalizedFailureReason=A 200 response was loaded from the URL 'http://myhost/sent/', which failed to match all (0) response descriptors:, NSErrorFailingURLStringKey=http://myhost/sent/, NSErrorFailingURLKey=http://myhost/sent/, NSUnderlyingError=0x11007f790 "No mappable object representations were found at the key paths searched.", keyPath=null, NSLocalizedDescription=No response descriptors match the response loaded.
配置restkit在我的代碼:
// initialize RestKit
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
NSManagedObjectModel *managedObjectModel = [NSManagedObjectModel mergedModelFromBundles:nil];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
objectManager.managedObjectStore = managedObjectStore;
RKEntityMapping *sentMapping = [RKEntityMapping mappingForEntityForName:@"Sent" inManagedObjectStore:managedObjectStore];
sentMapping .identificationAttributes = @[ @"message_id" ];
[sentMapping addAttributeMappingsFromDictionary:@{
@"objectId":@"message_id",
@"ToUserName":@"email_to",
@"createdAt":@"date_send",
@"Read":@"read"
}];
RKResponseDescriptor *responseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:sentMapping
method:RKRequestMethodGET
pathPattern:@"/sent/"
keyPath:@"results"
statusCodes:[NSIndexSet indexSetWithIndex:200]];
[objectManager addResponseDescriptor:responseDescriptor];
我在做什麼錯?
我不認爲這與你的tableview有很大關係。可能與映射有關。 – YarGnawh
@YarGnawh正確初始化第二種情況下的restkit? –