aka*_*aru 1 iphone cllocationmanager cllocation alassetslibrary ios5
这是一个可怕的错误.使用CLLocationManger时,无论是使用startUpdatingLocation还是使用ALAsset方法来访问照片的元数据,系统都会按预期提示进行位置访问...但是一旦显示,提示就会消失.我找不到这个的原因,我希望别人有这个问题.其他警报(例如显示UIAlertView)不会发生这种情况.
我甚至可以设置目的属性,然后显示,但只是暂时,它只是关闭自己.
这对我来说是个大问题,因为我需要获得许可才能使用照片元数据.
您是否在这样的方法中创建CLLocationManager实例:
-(void) viewDidAppear:(BOOL)animated {
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
}
Run Code Online (Sandbox Code Playgroud)
如果是这样,那么一旦函数退出,就会清除本地locationManager变量.您应该在实例或静态变量中保存对locationManager的引用:
static CLLocationManager *locationManager;
-(void) viewDidAppear:(BOOL)animated {
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
957 次 |
| 最近记录: |