1
我能夠獲得所有需要的RKObjectLoaderDelegate方法,在使用loadObjectsAtResourcePath執行GET時調用:delegate :.RKObjectLoaderDelegate方法沒有用post調用:params:delegate:
但是,當我使用post:params:delegate:進行POST時,只請求:didLoadResponse:被調用。即使像objectLoader:didLoadObjects:和objectLoader:didFailWithError:這樣的方法也沒有被調用。
這是代碼片段。
self.appObjectManager.client = [RKObjectManager managerWithBaseURLString:self.webServiceURLString];
[self.appObjectManager.client setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[self.appObjectManager.client setValue:@"" forHTTPHeaderField:@"Cookie"];
RKObjectMapping* sessionInformationMapping = [RKObjectMapping mappingForClass:[sessionInformation class]];
[sessionInformationMapping mapKeyPath:@"uid" toAttribute:@"userID"];
[self.appObjectManager.mappingProvider setObjectMapping:sessionInformationMapping forKeyPath:@"user"];
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"abc", @"pwd", nil]
forKeys:[NSArray arrayWithObjects:@"username", @"password", nil]];
[self.appObjectManager.client post:resourcePath params:parameters delegate:self];
我在這裏發現了一個類似的問題,但它似乎並沒有幫助我。 RestKit: What delegate method is called for postObject?
工作。謝謝。 – OutOnAWeekend