我在iOS 7上运行良好的应用程序无法与iOS 8 SDK一起使用.
CLLocationManager没有返回位置,我也没有在设置 - > 位置服务下看到我的应用程序.我在这个问题上进行了谷歌搜索,但没有出现任何问题.可能有什么不对?
我试图使用Xcode 6.3.1中的核心位置框架获取用户的当前位置,我做了以下事情:
我的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)我的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)