相关疑难解决方法(0)

位置服务在iOS 8中不起作用

我在iOS 7上运行良好的应用程序无法与iOS 8 SDK一起使用.

CLLocationManager没有返回位置,我也没有在设置 - > 位置服务下看到我的应用程序.我在这个问题上进行了谷歌搜索,但没有出现任何问题.可能有什么不对?

location objective-c cllocationmanager ios8

606
推荐指数
15
解决办法
27万
查看次数

核心位置委托方法未在iOS 8.3 Xcode 6.3.1中调用

我试图使用Xcode 6.3.1中的核心位置框架获取用户的当前位置,我做了以下事情:

  1. Target - > General - > Linked Frameworks&Libraries下添加了Core Location Framework
  2. 我的ViewController.h文件如下所示,

    #import <UIKit/UIKit.h>
    #import <CoreLocation/CoreLocation.h>
    
    @interface ViewController : UIViewController<CLLocationManagerDelegate>
    @property (weak, nonatomic) IBOutlet UILabel *lblLatitude;
    @property (weak, nonatomic) IBOutlet UILabel *lblLongitude;
    @property (weak, nonatomic) IBOutlet UILabel *lblAddress;
    @property (strong, nonatomic) CLLocationManager *locationManager;
    
    @end
    
    Run Code Online (Sandbox Code Playgroud)
  3. 我的ViewController.m文件如下所示,

    - (void)viewDidLoad
    {
    
    [super viewDidLoad];
    self.locationManager = [[CLLocationManager alloc] init];
    
    self.locationManager.delegate = self;
    if(IS_OS_8_OR_LATER){
        NSUInteger code = [CLLocationManager authorizationStatus];
        if (code == kCLAuthorizationStatusNotDetermined && ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)] || [self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])) …
    Run Code Online (Sandbox Code Playgroud)

core-location ios ios8.3 xcode6.3.1

15
推荐指数
1
解决办法
1691
查看次数