【发布时间】:2015-06-07 00:46:47
【问题描述】:
我的应用需要用户当前位置,以便向他显示到谷歌地图中特定位置的方向
以下是在网页视图中显示位置的代码-
[self.getDirectionsWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",currentLocation.coordinate.latitude,currentLocation.coordinate.longitude,self.projectLatitude,self.projectLongitude]]]];
应用通过使用 NSLocationAlwaysUsageDescription 和 NSLocationWhenInUseUsageDescription
声明支持 .plist 中的位置if([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
[locationManager requestAlwaysAuthorization];
}
[locationManager startUpdatingLocation];
Apple 拒绝了该应用程序,原因如下
2.16 详情
您的应用在 UIBackgroundModes 键中声明支持位置 您的 Info.plist 文件,但仍然没有声明任何功能 需要持久的位置。声明支持位置的应用程序 Info.plist 文件中的 UIBackgroundModes 键必须具有功能 需要永久位置。
具体来说,我们注意到路线功能不需要 持久的位置信息,因为它不包括 逐步导航。
任何帮助将不胜感激,在此先感谢。
【问题讨论】:
-
我会说他们在问你为什么在后台需要定位服务,因为你只在前台出现(对审核团队)使用它。
-
使用 [locationManager requestWhenInUseAuthorization] 而不是 [locationManager requestAlwaysAuthorization] 可能会解决这个问题!
标签: ios objective-c iphone ios8