2014-09-02 15:02:52.601 Crayfish[7211:60b] Error Domain=com.alamofire.error.serialization.response Code=-1016 “Request failed: unacceptable content-type: text/html”
从以上的错误提示来看问题已经明了了,unacceptable content-type: text/html“无法接受的内容类型“text/html”
解决办法:
找到AFURLResponseSerialization.m文件中的init方法
1 2 3 4 5 6 7 8 9 10 | - (instancetype)init { self = [super init]; if (!self) { return nil; } self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil]; return self; } |
self.acceptableContentTypes = [NSSet setWithObjects:@”application/json”, @”text/json”, @”text/javascript”, nil];
在这行代码中增加text/html类型
self.acceptableContentTypes = [NSSet setWithObjects:@”application/json”, @”text/json”, @”text/javascript”, @”text/html”, nil];
OK,搞定!