Note that there are some explanatory texts on larger screens.

plurals
  1. POsendSynchronousRequest fails under 3.1.2 after "Don't Allow" location fetch
    text
    copied!<p>I'm having a problem with doing a <code>sendSynchronousRequest</code> failing. It only fails after I try to get the current geolocation and the user hits "Don't Allow". And it only happens under 3.1.2. (As far as I can tell. It works fine in 3.0.1.)</p> <p>Here's what I do:</p> <p>I set up a very basic test app, that has almost nothing in it. In <code>applicationDidFinishLaunching</code> I add a call to my function, test, which is here:</p> <pre><code>- (void) test { CLLocationManager *mLM; mLM = [[CLLocationManager alloc] init]; mLM.delegate = self; if ( [mLM locationServicesEnabled] ) { [mLM startUpdatingLocation]; } } </code></pre> <p>My delegate methods are pretty simple too:</p> <pre><code>- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { [manager stopUpdatingLocation]; [self sendRequest]; // succeeds } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { [manager stopUpdatingLocation]; [self sendRequest]; // fails } </code></pre> <p>Finally, here's my sendRequest:</p> <pre><code>- (void) sendRequest { NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:@"https://theurl"]]; // this is actually a valid URL, changed here for privacy [request setHTTPMethod:@"GET"]; [request setCachePolicy:NSURLRequestReloadIgnoringCacheData]; NSString *unpw = @"username:password"; NSString *base64 = [NSString base64StringFromString:unpw]; [request addValue:[NSString stringWithFormat:@"Basic %@", base64] forHTTPHeaderField:@"Authorization"]; NSURLResponse *response = nil; NSError *error = nil; NSData *respdata = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;response error:&amp;error]; [request release]; } </code></pre> <p>The call to <code>sendSynchronousRequest</code> hangs. This has been very frustrating. Does anyone have any ideas?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload