小编San*_*nne的帖子

不会弹出用于位置权限的iOS警报视图

我刚刚开始我的iOS 8项目,我也遇到了一个问题,我无法提出问题以获得许可.我在info.plist中添加了以下内容

<key>NSLocationWhenInUseUsageDescription</key>
<string>The spirit of stack overflow is coders helping coders</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>I have learned more on stack overflow than anything else</string>
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

@interface ViewController () <MKMapViewDelegate>
@property (nonatomic, strong) UIPopoverController* userDataPopover;
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@property (strong, nonatomic, retain) CLLocationManager *locationManager;
@end

@implementation ViewController

-(CLLocationManager *)locationManager
{
    if(!_locationManager) _locationManager = [[CLLocationManager alloc]init];
    return _locationManager;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.mapView.delegate = self;
        [self.locationManager requestWhenInUseAuthorization];
        //[self.locationManager requestAlwaysAuthorization];

    [self.locationManager startUpdatingLocation];

    self.mapView.showsUserLocation = YES;
    [self.mapView showsUserLocation];
    [self.mapView setMapType:MKMapTypeStandard]; …
Run Code Online (Sandbox Code Playgroud)

ios xcode6 ios8

7
推荐指数
1
解决办法
2749
查看次数

标签 统计

ios ×1

ios8 ×1

xcode6 ×1