CLLocationManager prompt is displaying alert then disappearing

This is one awful bug. When using CLLocationManger, either with startUpdatingLocation or with ALAsset methods to access metadata for a photo, the system is prompting for location access as expected...but the prompt disappears as soon as it's shown. I cannot find the reason for this and am hoping someone else has had this problem. This does not occur with other alerts (such as showing a UIAlertView).

I can even set the purpose property, and it displays, but again, only for a moment then it just closes itself.

This is a big issue for me as I require permission in order to use photo metadata.

Answers


Are you creating the CLLocationManager instance in a method like so:

-(void) viewDidAppear:(BOOL)animated {
    CLLocationManager *locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];
}

If so, then as soon as the function exits, the local locationManager variable is being cleaned up. You should save a reference to the locationManager either on an instance or in a static variable:

static CLLocationManager *locationManager;
-(void) viewDidAppear:(BOOL)animated {
    locationManager = [[CLLocationManager alloc] init];
    locationManager.delegate = self;
    [locationManager startUpdatingLocation];
}

Need Your Help

Delphi - get same field pointer with RTTI e Addr

delphi rtti

Can I get the same pointer of a Field with RTTI and Addr(Field)?

Send user-made SVG (raphael.js) to server (php) so it can be sent by email

php javascript image raphael

I have a page where users can create their own SVG images. Now I would like to access these images on the server (php) so they can be sent to an email address.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.