我正在尝试使用以下代码使用加密字符串发出POST请求。作为响应,我从服务器获取null。我使用相同的值测试此https://www.hurl.it并获得200.无法确定问题出在哪里。
编码我使用的字符串
NSUTF8StringEncoding NSASCIIStringEncoding NSNEXTSTEPStringEncoding
forD = @"AAAAAAAAAMCYdiQv+wcAsBAAAAAAAAAAaQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMQswCQYDVQQGEwJVUzETMBEGA1UECBMKTkVXIEpFUlNFWTEZMBcGA1UEChMQVkVSSVpPTiBXSVJFTEVTUzENMAsGA1UECxMETUlQUzEbMBkAAAAAAAAAwAAAAAAAAADACABUSUNTLTAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABUfCQv+wcA8L4GJC/7BwAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1ZwkL/sHAFCDeyQv+wcQAA==";
NSData* requestData = [forD dataUsingEncoding:NSASCIIStringEncoding];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:baseURL]];
[request setHTTPMethod:@"POST"];
[request setValue:@"1" forHTTPHeaderField:@"Appversion"];
[request setValue:@"*/*" forHTTPHeaderField:@"Accept"];
[request setValue:@"gzip,deflate" forHTTPHeaderField:@"Accept-Encoding"];
[request setHTTPBody: requestData];
NSLog(@"%@", [request allHTTPHeaderFields]);
NSLog(@"%@", [request HTTPBody]);
NSURLResponse *response;
NSError *error = nil;
NSData *receivedData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSLog(@"\n\n === RESPONSE SERVER ==== \n\n %@",[NSJSONSerialization JSONObjectWithData:receivedData options:0 error:nil]);