为什么在进行 API 调用时 RestKit 会删除我的路径?它表明它在通话之前很好。
这就是我注册它的方式
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:[[NSUserDefaults standardUserDefaults] objectForKey:@"apiURL"]]];
[client setDefaultHeader:@"Accept" value:RKMIMETypeJSON];
[client setParameterEncoding:AFJSONParameterEncoding];
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
NSLog(@"Created client: %@", objectManager.HTTPClient);
这就是我在其他课程中的称呼
RKObjectManager *manager = [RKObjectManager sharedManager];
NSLog(@"HTTP Client: %@", manager.HTTPClient);
即使在我调用共享 objectManager 的其他类中,它也是正确的,但是我在调用过程中得到了日志记录,并且响应错误,因为它/api/v1
被取出了。
NSLOG
2013-03-13 13:24:08.960 Project[54631:403] HTTP Client: <AFHTTPClient: 0x1033d6230, baseURL: https://my.server.com/api/v1/, defaultHeaders: {
Accept = "application/json";
"Accept-Language" = "en, ja, fr, de, es, it, pt, pt-PT, nl, sv, nb, da, fi, ru, pl, zh-Hans, zh-Hant, ko, ar, cs, hu, tr, en-us;q=0.8";
Authorization = "Bearer <My Access Token>";
"User-Agent" = "Project/1.0 (Mac OS X Version 10.7.5 (Build 11G63))";
}, registeredOperationClasses: (
), operationQueue: <NSOperationQueue: 0x1033db8c0>{name = 'NSOperationQueue 0x1033db8c0'}>
2013-03-13 13:24:08.960 Project[54631:403] Manager: <RKObjectManager: 0x1033db940>
2013-03-13 13:24:08.971 Project[54631:403] I restkit.network:RKHTTPRequestOperation.m:154 GET 'https://my.server.com/features/1234?with_lock=false'
2013-03-13 13:24:09.310 Project[54631:403] I restkit.network:RKHTTPRequestOperation.m:185 GET 'https://my.server.com/features/1234?with_lock=false' (200 OK)