Hey stack,
I've had a working version of our codebase working on 3.1.3 and 3.2, and recently we've noticed a substantial drop in the traffic to the URL this request is hitting. After investigation, I noticed that there is no longer any traffic to this URL, subsequently breaking the app completely.
This exact code will properly execute a thread and return data. We are absolutely stumped on this.
I've got a block of code that's doing this:
{
NSString *post = @"data={\"*\":\"dls\"}";
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding];// allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSString *url = @"urlremoved";
UrlDownloaderOperation *op = [UrlDownloaderOperation urlDownloaderWithUrlString:url
delegate:self
didFinishSelector:@selector(requestDVDsDidFinishWithData:)
didFailSelector:@selector(requestDVDsDidFailWithError:)];
[op setMethod:@"POST"];
[op setContentType:@"application/x-www-form-urlencoded"];
[op setContentLength:postLength];
[op setBody:postData];
[queue addOperation:op];
}
and the UrlDownloaderOperation op
- (void)start
{
[self willChangeValueForKey:@"isExecuting"];
_isExecuting = YES;
[self didChangeValueForKey:@"isExecuting"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:_url];
[request setTimeoutInterval:20.0f];
if (parameters != nil && [parameters count] > 0)
{
NSMutableString *params = [@"?" mutableCopy];
for (NSString *key in [parameters allKeys])
{
params = [NSString stringWithFormat:@"%@%@=%@&", params, key, [parameters objectForKey:key]];
}
NSRange range;
range.location = [params length] - 1;
range.length = 1;
params = [NSMutableString stringWithFormat:[params stringByReplacingCharactersInRange:range withString:@""]];
NSString *escapedParams = [params stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];
NSData *paramsData = [NSData dataWithBytes:[escapedParams UTF8String] length:[escapedParams length]];
request = [NSMutableURLRequest requestWithURL:_url];
[request setHTTPMethod:@"POST" ];
[request setHTTPBody:paramsData];
}
if (headers != nil)
{
[request setAllHTTPHeaderFields:headers];
}
if (method != nil)
[request setHTTPMethod:[self method]];
if (contentLength != nil)
[request setValue:[self contentLength] forHTTPHeaderField:@"Content-Length"];
if (contentType != nil)
[request setValue:[self contentType] forHTTPHeaderField:@"Content-Type"];
if (body != nil)
[request setHTTPBody:body];
_connection = [[NSURLConnection alloc] initWithRequest:request
delegate:self];
if (_connection == nil)
[self finish];
}
Once i get to this point, however, the thread disappears and the rest of the app continues on. Where should I even start in trying to debug this?