AFHTTPRequestOperationManager * manager = [AFHTTPRequestOperationManager manager];
// manager.responseSerializer = [AFJSONResponseSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject: @"text/plain"];
[manager POST:@"http://wu.itmingong.org:9090/WuNetbars/app/login.do"parameters:parameters success:^(AFHTTPRequestOperation *operation,idresponseObject) {
// NSDictionary * dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
NSLog(@"success");
} failure:^(AFHTTPRequestOperation *operation,NSError*error) {
NSLog(@"錯誤,%@", error);
}];
|
是請求頭的問題麼?求大神指點 javascript
終於搞好了,緣由是我用加密過的字符串,其中有加減等特殊符號,AFN框架直接處理字符串時會改變這些特殊符號和加些字符串,因此修改AFN內部這一部分便可
html
NSString *query = nil;
if (self.queryStringSerialization) {
NSError *serializationError;
query = self.queryStringSerialization(request, parameters, &serializationError);
if (serializationError) {
if (error) {
*error = serializationError;
}
return nil;
}
query = (NSString *)parameters;
添加最後一句就行了,前面是AFN判斷修改的
java