JSON text did not start with array or object and option to allow fragments not set. === AFN使用報錯: Error Domain=NSCocoaErrorDomain Code=3840 "JSON text
JSON text did not start with array or object and option to allow fragments not set.
AFN使用報錯:
Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
網上查了查資料,AFN返回的數據responseObject預設以JSON的方式處理,如果返回的是個HTML或者其他的就會報錯。。解決辦法,告訴AFN返回的數據不用JSON處理。代碼就一句,如下:
manager.responseSerializer = [AFHTTPResponseSerializer serializer]