2016-08-04 27 views
5

我想在设置像下面的图像中添加位置服务使用的应用程序说明。有没有人有想法如何做到这一点?谢谢! app explanation for location service如何在设置中添加位置服务的应用程序说明

+0

如果你想加入的iPhone的设置您的应用程序的一些信息。您可以使用“捆绑设置”。 [教程](https://github.com/Weijay/SettingsBundle) – WeiJay

回答

6

您可以在您的Xcode项目的Info.plist中添加说明。

<key>NSLocationAlwaysUsageDescription</key> 
<string>The applicaiton requires location services to workss</string> 

看到下面的图片

enter image description here

见下文

enter image description here

1

结果可以在info.plist

<key>NSLocationAlwaysUsageDescription</key> 
<string>This application requires location services to work</string> 
<key>NSLocationWhenInUseUsageDescription</key> 
<string>This application requires location services to work</string> 
添加代码

enter image description here

并且还检查位置服务权限。

if([CLLocationManager locationServicesEnabled]){ 

      NSLog(@"Location Services Enabled"); 

      if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){ 
       alert = [[UIAlertView alloc] initWithTitle:@"App Permission Denied" 
                 message:@"To re-enable, please go to Settings and turn on Location Service for this app." 
                 delegate:nil 
               cancelButtonTitle:@"OK" 
               otherButtonTitles:nil]; 
       [alert show]; 
      } 
     } 
1

@Rurouni的答案是完美的。

Xcode 8中的一些更新。他们给我们列出了plist中的Privacy。

从此我们可以添加:

隐私 - 位置用法说明

<key>NSLocationUsageDescription</key> 
<string>This application will use location service for user location sharing.</string> 

enter image description here

相关问题