久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

          <bdo id='NinaO'></bdo><ul id='NinaO'></ul>
        <legend id='NinaO'><style id='NinaO'><dir id='NinaO'><q id='NinaO'></q></dir></style></legend>

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

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

      2. <i id='NinaO'><tr id='NinaO'><dt id='NinaO'><q id='NinaO'><span id='NinaO'><b id='NinaO'><form id='NinaO'><ins id='NinaO'></ins><ul id='NinaO'></ul><sub id='NinaO'></sub></form><legend id='NinaO'></legend><bdo id='NinaO'><pre id='NinaO'><center id='NinaO'></center></pre></bdo></b><th id='NinaO'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='NinaO'><tfoot id='NinaO'></tfoot><dl id='NinaO'><fieldset id='NinaO'></fieldset></dl></div>
      3. Mac 上的 iOS 7 模擬器不適用于自定義位置(也不會

        iOS 7 Simulator on Mac doesn#39;t work with custom location (Also doesn#39;t ask permission)(Mac 上的 iOS 7 模擬器不適用于自定義位置(也不會請求許可))
      4. <legend id='EVkuf'><style id='EVkuf'><dir id='EVkuf'><q id='EVkuf'></q></dir></style></legend>
          <tbody id='EVkuf'></tbody>

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

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

                • 本文介紹了Mac 上的 iOS 7 模擬器不適用于自定義位置(也不會請求許可)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試制作一個使用設備當前位置的 iOS7 應用程序.我在我的 Mac 上使用 iPhone 模擬器,但我遇到了一些問題.每次出現位置管理器所在的視圖時,它都會打印出 0.000000 的緯度和經度,即使在我設置了自定義位置(從模擬器>調試>位置)之后也是如此.

                  I'm trying to make an iOS7 app that uses the current location of the device. I'm using the iPhone simulator on my Mac, but I'm having some problems. Every time my view that the location manager is in appears, it prints out 0.000000 for both latitude and longitude, even after I've set a custom location (from simulator>debug>location).

                  此外,模擬器在打開應用程序時沒有請求使用當前位置的權限似乎很奇怪.有人知道這里發生了什么嗎?

                  Also, it seemed strange that the simulator didn't ask for permission to use current location when it opened the app. Anybody know what's going on here?

                  - (void)viewDidLoad
                  {
                      [super viewDidLoad];
                      // Do any additional setup after loading the view, typically from a nib.
                      [super viewDidLoad];
                      CLLocationManager *locationManager = [[CLLocationManager alloc] init];
                      locationManager.delegate = self;
                      locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
                      locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
                      [locationManager startUpdatingLocation];
                  
                      _location = [locationManager location];
                  
                  
                      _coord.longitude = _location.coordinate.longitude;
                      _coord.latitude = _location.coordinate.latitude;
                  }
                  
                  - (void)viewWillAppear:(BOOL)animated
                  {
                      [super viewWillAppear:animated];
                      _coord.longitude = _location.coordinate.longitude;
                      _coord.latitude = _location.coordinate.latitude;
                      printf("%f
                  ",self.coord.longitude);
                      printf("%f
                  ",self.coord.latitude);
                  }
                  

                  推薦答案

                  需要從委托方法didUpdateLocationToLocation:fromLocation:中獲取newLocation.還要實現 didFailWithError 委托方法.您需要一些時間才能開始獲取更新的位置,因此需要委托調用.

                  You need to get the newLocation from the delegate method didUpdateLocationToLocation:fromLocation:. Also implement didFailWithError delegate method. It takes some time before you start getting updated locations, hence the delegate call.

                  最后一個位置通常被緩存,因此檢查位置的時間戳并將舊位置過濾掉可能是明智之舉.

                  The last location is usually cached, so it maybe wise to check location's timestamp and filter the old location out.

                  這是我能提供的最簡潔的例子.在 Xcode 中啟動新項目,選擇 Single View 應用程序模板,iPhone.不要觸摸情節提要,只需用它替換 ViewController.m 的內容并在模擬器或設備中運行.如果在模擬器上,請轉到調試并設置一些位置,您將在控制臺中獲得坐標.當視圖打開或關閉屏幕時,我也會開始和停止位置更新.

                  This is the cleanest example I can provide. Start new project in Xcode, pick Single View application template, iPhone. Don't touch storyboard, just replace content of your ViewController.m with this and run in Simulator or device. If on Simulator, go to Debug and set some location and you will get coordinates in the console. I am also starting and stopping location updates when the view goes on or off screen.

                  #import "ViewController.h"
                  #import <CoreLocation/CoreLocation.h>
                  
                  @interface ViewController () <CLLocationManagerDelegate>
                  
                  @property (strong, nonatomic) CLLocationManager *locationManager;
                  
                  @end
                  
                  @implementation ViewController
                  
                  #pragma mark - Location Manager delegate methods
                  
                  - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
                  
                      if ([newLocation.timestamp timeIntervalSinceNow] >= -300.0) {
                  
                          NSLog(@"updated location with latitude %f longitude %f", newLocation.coordinate.longitude, newLocation.coordinate.latitude);
                      }
                  }
                  
                  - (void)viewWillAppear:(BOOL)animated
                  {
                      [super viewWillAppear:animated];
                  
                      [self.locationManager startUpdatingLocation];
                  }
                  
                  - (void)viewWillDisappear:(BOOL)animated
                  {
                      [super viewWillDisappear:animated];
                  
                      [self.locationManager stopUpdatingLocation];
                  }
                  
                  - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error     {
                      if(error.code == kCLErrorDenied) {
                  
                          // alert user
                          UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Access to location services is disabled"
                                                                          message:@"You can turn Location Services on in Settings -> Privacy -> Location Services"
                                                                         delegate:nil
                                                                cancelButtonTitle:@"OK"
                                                                otherButtonTitles:nil];
                          [alertView show];
                  
                      } else if(error.code == kCLErrorLocationUnknown) {
                          NSLog(@"Error: location unknown");
                      } else {
                          NSLog(@"Error retrieving location");
                      }
                  }
                  
                  #pragma mark - Location Manager getter
                  
                  - (CLLocationManager *)locationManager
                  {
                      if (!_locationManager) {
                          _locationManager = [[CLLocationManager alloc] init];
                          _locationManager.delegate = self;
                          _locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
                          _locationManager.distanceFilter = 60.0;
                      }
                      return _locationManager;
                  }
                  
                  @end
                  

                  這篇關于Mac 上的 iOS 7 模擬器不適用于自定義位置(也不會請求許可)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Help calculating X and Y from Latitude and Longitude in iPhone(幫助從 iPhone 中的緯度和經度計算 X 和 Y)
                  Get user#39;s current location using GPS(使用 GPS 獲取用戶的當前位置)
                  IllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 拋出的 IllegalArgumentException)
                  How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新一次?)
                  CLLocation returning negative speed(CLLocation 返回負速度)
                  How to detect Location Provider ? GPS or Network Provider(如何檢測位置提供者?GPS 或網絡提供商)

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

                  <legend id='fwjIw'><style id='fwjIw'><dir id='fwjIw'><q id='fwjIw'></q></dir></style></legend>
                        <tbody id='fwjIw'></tbody>

                      • <bdo id='fwjIw'></bdo><ul id='fwjIw'></ul>

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

                            <tfoot id='fwjIw'></tfoot>
                            主站蜘蛛池模板: 99久久婷婷国产综合精品电影 | 国产精品久久久久久吹潮 | av黄色在线 | www.se91| 精品成人免费一区二区在线播放 | 国产精品久久久久婷婷二区次 | 久草热线| 国产美女精品 | 精品一区二区三区中文字幕 | 国产一区二区三区 | 欧美精品91 | 国产精品a一区二区三区网址 | 一区二区在线观看免费视频 | 二区高清| 毛片久久久 | 亚欧性视频 | 美日韩中文字幕 | 欧洲一级毛片 | 亚洲视频在线观看 | av午夜电影| 久久一区二区视频 | 北条麻妃一区二区三区在线视频 | 国产精品视频一二三区 | 国产精品精品久久久 | 粉嫩av久久一区二区三区 | 巨大荫蒂视频欧美另类大 | 伊人精品在线 | 亚洲高清av | 午夜爽爽爽男女免费观看影院 | 免费看国产a | 国产精品免费小视频 | 香蕉视频黄色 | 一区二区免费在线 | 日韩欧美手机在线 | 成人午夜毛片 | 久久久久久成人网 | 99国产视频 | 免费a国产| av在线免费网 | 中文字幕一区在线 | 国产精品久久久久久亚洲调教 |