Ios RestKit中MIME类型“text/html”的解析器
我使用的是RestKit v0.20.3,当我获得对GET HTTP请求的响应时,我无法解析它,因为我得到以下错误:Ios RestKit中MIME类型“text/html”的解析器,ios,restkit,restkit-0.20,Ios,Restkit,Restkit 0.20,我使用的是RestKit v0.20.3,当我获得对GET HTTP请求的响应时,我无法解析它,因为我得到以下错误: Failed to parse response data: Loaded an unprocessable response (200) with content type 'text/html' UserInfo=0x6c4a2b0 {NSErrorFailingURLKey=https://helloEverybody.com/, NSUnderlyingError=0
Failed to parse response data: Loaded an unprocessable response (200)
with content type 'text/html' UserInfo=0x6c4a2b0
{NSErrorFailingURLKey=https://helloEverybody.com/, NSUnderlyingError=0x6c4a1e0
"The operation couldn’t be completed. (Cocoa error 3840.)"
这是我的密码:
[RKMIMETypeSerialization registerClass:[RKNSJSONSerialization class] forMIMEType:@"text/html"];
NSURL *baseUrl = [[NSURL alloc]initWithString:@"https://helloEverybody.com"];
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:baseUrl];
[objectManager.HTTPClient setAuthorizationHeaderWithUsername:@"user" password:@"password"];
[objectManager setAcceptHeaderWithMIMEType:@"text/html"];
[objectManager getObjectsAtPath:@"" parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSLog(@"It worked!!: %@", [mappingResult firstObject]);
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"It failed: %@", error);
}];
我读过很多类似的帖子,他们通常会将服务器响应更改为json来解决这个问题,但我不能接触服务器。我需要解析这些文本/html
有人知道我怎么做吗
谢谢 响应是否真的有效。