iOS 重新授权定位 授权完成回调
2017-08-08 本文已影响0人
BeeQiang
写一个通知
1 添加 #import "AppDelegate.h"
UIApplication *application = [UIApplication sharedApplication];
2 注册通知
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(applicationDidBecomeActive:) name:@"UIApplicationDidBecomeActiveNotification" object:application];
3 发起通知
[[NSNotificationCenter defaultCenter]postNotificationName:@"UIApplicationDidBecomeActiveNotification" object:nil];
4 接收通知执行的方法
- (void)applicationDidBecomeActive:(NSNotification *)notification {
if ([CLLocationManager locationServicesEnabled]&&([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse||[CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedAlways))
{
//如果定位可用
[self reloadGPS];
}