Note that there are some explanatory texts on larger screens.

plurals
  1. POAlert window that asks for permission to use current location in iOS app does not give user a chance to choose between "don't allow" and "OK"
    primarykey
    data
    text
    <p>I am new to objective-c and iOS programming and have been trying to setup this gps/location app from scratch for the past 3 hours using xcode 5 and an iOS7 iPhone. So far the app successfully loads on my iphone. The user interface has an empty label and a button. When I tap the button, it says "YourGPSApp would like to use your current location" and then has a "Don't allow" and an "OK" option.</p> <p>However, the window goes away before you can even select one of the options. I need the window to stay and let the user select an option.</p> <p>Here is what I have done so far:</p> <ol> <li><p>Created a property for IBOutlet UILabel object in the header file and connected it with the user interface.</p></li> <li><p>Defined an IBAction method in the header file and connected it with the button on the UI.</p></li> </ol> <p>This is the final result in my header file:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @interface ViewController : UIViewController; @property (nonatomic, strong) IBOutlet UILabel *gpsLabel; -(IBAction)gpsButton; @end </code></pre> <p>And then I edited the main file and ended up with this source code:</p> <pre><code>#import "ViewController.h" #import &lt;CoreLocation/CoreLocation.h&gt; @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(IBAction)gpsButton { CLLocationManager * gpsLM = [[CLLocationManager alloc]init]; [gpsLM startUpdatingLocation]; } @end </code></pre> <p>At this point I am 99% sure that when I tap the gpsButton that I setup in the header that it is successfully asking the user's iPhone what it's location is because I get the window alert asking if I would like to allow it to see my location.</p> <p>I also went to my iPhone settings and manually turned on location services for this app. Then I went back to the app screen and pressed the button again and it shows the "finding location" arrow next to the batter up in the top right of the iPhone screen and also displays the same arrow next to my app's name when I go back to my iPhone's location settings.</p> <p>This tells me that my "location finding" methods are working correctly.</p> <p>I just really need to figure out how to keep the window from disappearing so the user can select "Don't Allow" or "OK".</p> <p>Thanks for the help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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