我正在创建 NSMutableRequest 并将数据添加到正文。下面是我如何做到这一点的例子:
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:stringURL]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:230.0];
NSLog(@"Time out interval: %f", request.timeoutInterval); >> Output: 230
[request setHTTPBody:[body dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"Time out interval: %f", request.timeoutInterval); >> Output: 240
[request setTimeoutInterval:230];
NSLog(@"Time out interval: %f", request.timeoutInterval); >> Output: 240
创建后请求超时为230。设置body后为240。在我将其重置为230后。它仍然是240。除非我将它设置得更大,否则超时值不会改变?
有人知道为什么会这样吗?如何使超时间隔小于 240 秒?