iOS - RestKit 的内容类型错误

iOS - Content type error with RestKit

正在执行如下 GET 请求:

manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:kBaseUrl]];
[manager setAcceptHeaderWithMIMEType:@"application/json"];
[manager setRequestSerializationMIMEType:RKMIMETypeJSON];

RKObjectRequestOperation* operation = [manager appropriateObjectRequestOperationWithObject:nil method:RKRequestMethodGET path:@"www.mypath.com" parameters:nil];
[operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
    ....    
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
    ....
}];
[manager enqueueObjectRequestOperation:operation];

即使内容类型设置为 'application/json' 我得到:

Error Domain=org.restkit.RestKit.ErrorDomain Code=-1016 "Expected content type {( "application/x-www-form-urlencoded", "text/html", "application/json" )}, got application/javascript"

有什么想法吗?

似乎无论请求内容类型是什么,服务器的回答总是内容类型'application/javascript'。

解决方法是:

[RKMIMETypeSerialization registerClass:[RKNSJSONSerialization class] forMIMEType:@"application/javascript"];