我正在发布一个小图像,所以我希望超时间隔很短。如果图像在几秒钟内没有发送,它可能永远不会发送。出于某种未知原因NSURLConnection
,无论我将timeoutInterval
.
// Create the URL request
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]
initWithURL:[NSURL URLWithString:@"http://www.tumblr.com/api/write"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:0.00000001];
/* Populate the request, this part works fine */
[NSURLConnection connectionWithRequest:request delegate:self];
我设置了一个断点,- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
但它从未被触发。我的图片继续发布得很好,尽管timeoutInterval
.