<legend id='m9Tn9'><style id='m9Tn9'><dir id='m9Tn9'><q id='m9Tn9'></q></dir></style></legend>

        <bdo id='m9Tn9'></bdo><ul id='m9Tn9'></ul>
    1. <i id='m9Tn9'><tr id='m9Tn9'><dt id='m9Tn9'><q id='m9Tn9'><span id='m9Tn9'><b id='m9Tn9'><form id='m9Tn9'><ins id='m9Tn9'></ins><ul id='m9Tn9'></ul><sub id='m9Tn9'></sub></form><legend id='m9Tn9'></legend><bdo id='m9Tn9'><pre id='m9Tn9'><center id='m9Tn9'></center></pre></bdo></b><th id='m9Tn9'></th></span></q></dt></tr></i><div id='m9Tn9'><tfoot id='m9Tn9'></tfoot><dl id='m9Tn9'><fieldset id='m9Tn9'></fieldset></dl></div>

      <small id='m9Tn9'></small><noframes id='m9Tn9'>

      <tfoot id='m9Tn9'></tfoot>
      1. iOS 8 requestWhenInUseAuthorization 没有弹出

        时间:2023-09-02

        <legend id='gx9sr'><style id='gx9sr'><dir id='gx9sr'><q id='gx9sr'></q></dir></style></legend>

          <i id='gx9sr'><tr id='gx9sr'><dt id='gx9sr'><q id='gx9sr'><span id='gx9sr'><b id='gx9sr'><form id='gx9sr'><ins id='gx9sr'></ins><ul id='gx9sr'></ul><sub id='gx9sr'></sub></form><legend id='gx9sr'></legend><bdo id='gx9sr'><pre id='gx9sr'><center id='gx9sr'></center></pre></bdo></b><th id='gx9sr'></th></span></q></dt></tr></i><div id='gx9sr'><tfoot id='gx9sr'></tfoot><dl id='gx9sr'><fieldset id='gx9sr'></fieldset></dl></div>
            <tbody id='gx9sr'></tbody>

              • <bdo id='gx9sr'></bdo><ul id='gx9sr'></ul>
                <tfoot id='gx9sr'></tfoot>
              • <small id='gx9sr'></small><noframes id='gx9sr'>

                  本文介绍了iOS 8 requestWhenInUseAuthorization 没有弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我试图让我的 AppProject iOS 8 准备就绪.我读了很多关于

                  I tried to make my AppProject iOS 8 ready. I had read a lot about

                  [_locationManager requestWhenInUseAuthorization];
                  

                  和plist中的条目

                  NSLocationWhenInUseUsageDescription
                  

                  所以我更改了所有必要的代码行.

                  So I changed all the necessary code lines.

                  它工作正常,但现在我再次从我的 iOS 7 基础复制我的项目以包含新功能.但是当我对 iOS8 位置隐私进行更改时,弹出窗口不再出现.

                  It works fine, but now I have copied my project again from my iOS 7 base to include new features. But when I make the changes for the iOS8 Location Privacy the Popup doesn't appear anymore.

                  我的代码在我复制之前一直有效.

                  My code worked until I copied.

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
                  <plist version="1.0">
                      <dict>
                          <key>NSLocationWhenInUseUsageDescription</key>
                          <string>tolle sache </string>
                          <key>CFBundleDevelopmentRegion</key>
                          <string>en</string>
                          <key>CFBundleExecutable</key>
                          <string>${EXECUTABLE_NAME}</string>
                          <key>CFBundleIdentifier</key>
                          <string>fapporite.${PRODUCT_NAME:rfc1034identifier}</string>
                          <key>CFBundleInfoDictionaryVersion</key>
                          <string>6.0</string>
                          <key>CFBundlePackageType</key>
                          <string>BNDL</string>
                          <key>CFBundleShortVersionString</key>
                          <string>1.0</string>
                          <key>CFBundleSignature</key>
                          <string>????</string>
                          <key>CFBundleVersion</key>
                          <string>1</string>
                      </dict>
                  </plist>
                  

                  这是我的电话

                  - (instancetype)initWithCoder:(NSCoder *)coder
                  {
                      self = [super initWithCoder:coder];
                      if (self) {
                  
                          _UserLocation = [[CLLocation alloc]init];
                          _locationManager = [[CLLocationManager alloc]init]; // initializing locationManager
                          _locationManager.delegate = self;
                          _locationManager.desiredAccuracy = kCLLocationAccuracyBest; // setting the accuracy
                          [_locationManager requestWhenInUseAuthorization]; // iOS 8 MUST
                          [_locationManager startUpdatingLocation];  //requesting location updates
                  
                          NSLog(@"passed initwithcode");
                  
                      }
                      return self;
                  }
                  

                  我该如何解决这个问题?

                  How can I fix this?

                  推荐答案

                  来自文档

                  NSLocationWhenInUseUsageDescription (String - iOS) 描述了应用程序在运行时正常访问用户位置的原因在前台.当您的应用使用位置信息时包含此密钥直接跟踪用户当前位置的服务.这把钥匙不支持使用位置服务监控区域或监控使用重大位置更改服务的用户位置.这系统在显示的警报面板中包含此键的值请求使用位置服务的权限时的用户.

                  NSLocationWhenInUseUsageDescription (String - iOS) describes the reason why the app accesses the user’s location normally while running in the foreground. Include this key when your app uses location services to track the user’s current location directly. This key does not support using location services to monitor regions or monitor the user’s location using the significant location change service. The system includes the value of this key in the alert panel displayed to the user when requesting permission to use location services.

                  使用 requestWhenInUseAuthorization 时需要此密钥CLLocationManager 类的方法来请求授权位置服务.如果在您调用requestWhenInUseAuthorization 方法不包括这个键,系统会忽略您的请求.

                  This key is required when you use the requestWhenInUseAuthorization method of the CLLocationManager class to request authorization for location services. If the key is not present when you call the requestWhenInUseAuthorization method without including this key, the system ignores your request.

                  iOS 8.0 及更高版本支持此键.如果您的 Info.plist 文件包括这个键和 NSLocationUsageDescription 键,系统使用此键并忽略 NSLocationUsageDescription 键.

                  This key is supported in iOS 8.0 and later. If your Info.plist file includes both this key and the NSLocationUsageDescription key, the system uses this key and ignores the NSLocationUsageDescription key.

                  阅读它这里.

                  我发现将此键添加到 info.plist 的最简单方法是右键单击 info.plist 并选择

                  I find that the easiest way to add this key to your info.plist is to right click you info.plist and choose

                  打开为->源代码

                  然后在最后before </dict></plist>

                  <key>NSLocationWhenInUseUsageDescription</key>
                  <string></string>
                  

                  如果你愿意,你可以在 <string></string> 之间添加一个文本,向用户描述你为什么要使用他/她的位置.此文本将显示在警报的默认文本下.

                  If you want you can add a text in between <string></string> that describes to the user why you want to use his/hers location. This text will show up under the default text in the alert.

                  这篇关于iOS 8 requestWhenInUseAuthorization 没有弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在 Google Maps for Android API v2 上显示我的位置 下一篇:如何持续追踪安卓手机的位置?

                  相关文章

                  最新文章

                • <i id='D0jMH'><tr id='D0jMH'><dt id='D0jMH'><q id='D0jMH'><span id='D0jMH'><b id='D0jMH'><form id='D0jMH'><ins id='D0jMH'></ins><ul id='D0jMH'></ul><sub id='D0jMH'></sub></form><legend id='D0jMH'></legend><bdo id='D0jMH'><pre id='D0jMH'><center id='D0jMH'></center></pre></bdo></b><th id='D0jMH'></th></span></q></dt></tr></i><div id='D0jMH'><tfoot id='D0jMH'></tfoot><dl id='D0jMH'><fieldset id='D0jMH'></fieldset></dl></div>

                  1. <tfoot id='D0jMH'></tfoot>

                    1. <small id='D0jMH'></small><noframes id='D0jMH'>

                    2. <legend id='D0jMH'><style id='D0jMH'><dir id='D0jMH'><q id='D0jMH'></q></dir></style></legend>
                      • <bdo id='D0jMH'></bdo><ul id='D0jMH'></ul>