下面是iOS7和iOS8申请定位权限时的不同:
self.locationManager = [[CLLocationManager alloc]init];
self.locationManager.delegate = self;
[self.locationManager requestWhenInUseAuthorization];
或者这样:
if([CLLocationManager locationServicesEnabled])
{
self.locationManage = [[[CLLocationManager alloc] init] autorelease];
self.locationManage.delegate = self;
;
self.locationManage.desiredAccuracy = kCLLocationAccuracyBestForNavigation;
//kCLLocationAccuracyBest;
if (SYSTEM_VERSION >= 8.0) {
//使用期间
[self.locationManage requestWhenInUseAuthorization];
//始终
//or
[self.locationManage requestAlwaysAuthorization]
}
}
另外也提供下新增下面的代理方法:
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
switch (status) {
case kCLAuthorizationStatusNotDetermined:
if ([self.locationManage respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[self.locationManage requestWhenInUseAuthorization];
}
break;
default:
break;
}
}
详情见https://app.yinxiang.com/l/ABarZZCJ2_dAd7B0ncWryoyV2bZ06fI1_WM
@interface AppDelegate()<CLLocationManagerDelegate>
{
UINavigationController *_navController;
CLLocationManager *_locationmanager;
}
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[UIApplicationsharedApplication].idleTimerDisabled = TRUE;
_locationmanager = [[CLLocationManager alloc] init];
[_locationmanager requestAlwaysAuthorization]; //NSLocationAlwaysUsageDescription
[_locationmanager requestWhenInUseAuthorization]; //NSLocationWhenInUseUsageDescription
_locationmanager.delegate = self;
//....
}
Reasons:
- 2.16: Multitasking Apps may only use background services for their intended purposes: VoIP, audio playback, location, task completion, local notifications, etc.
Hello,
We found the following rejection while reviewing your app. Please see more details below.
We found that your app uses a background mode but does not include the following battery use disclaimer in your Application Description:
"Continued use of GPS running in the background can dramatically decrease battery life."
It would be appropriate to revise your Application Description to include this disclaimer.
If your iTunes Connect Application State is Metadata Rejected, we do NOT require a new binary.
To revise the metadata:
- Log in to iTunes Connect
- Click on “My Apps”
- Select your app
- Revise the desired metadata values
- Click “Save"
- Once you’ve completed all changes, click the “Submit for Review” button at the top of the App Details page
Kind Regards,
The App Review Team
本App的主要服务会持续使用GPS定位服务,切换至后时,仍会继续,相比其他操作会消耗更多的电量,并影响电池续航时间。
使用位置共享过程中,您可以随时退出,中止位置共享。本App不会将您的真实位置暴漏或提供给第三方。
Continued use of GPS running in the background can dramatically decrease battery life.
- iOS8 高德地图SDK MAMapView无法定位的问题(http://blog.csdn.net/johnzhjfly/article/details/39497751)
- iOS8 百度地图SDK MAMapView无法定位的问题
- iOS8 Location not accessible
- iOS8 MKMapView 代理无效问题
- Access the user's location on Today Extension
**************************************************************************
系列文章:老项目的#iPhone6与iPhone6Plus适配#(持续更新中,更新日期2014年10月12日 星期日 )
列表如下:
2.老项目的#iPhone6与iPhone6Plus适配#Icon适配
3.老项目的#iPhone6与iPhone6Plus适配#iOS8无法开启定位问题记起#解决方案#
4.老项目的#iPhone6于iPhone6Plus适配#iPhone6分辨率与适配
6.#iPhone6与iPhone6Plus适配#如何在Xcode 6中创建 PCH 文件
**************************************************************************
https://developer.apple.com/library/IOs/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html