didUpdateLocations가 호출되지 않고 대신 didFailWithError가 거부 된 코드 kCLErrorDenied
과 함께 호출됩니다.didUpdateLocations가 ios 9.3.2에서 호출되지 않았습니다.
#import "ViewController.h"
@import CoreLocation;
@interface ViewController() <CLLocationManagerDelegate>
@property (strong, nonatomic) CLLocationManager *locationManager;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
// Check for iOS 8. Without this guard the code will crash with "unknown selector" on iOS 7.
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(nonnull NSArray<CLLocation *> *)locations
{
NSLog(@"update");
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(nonnull NSError *)error
{
NSLog(@"error");
}
@end
이 응용 프로그램의 Info.plist 파일에 NSLocationWhenInUseUsageDescription
및 NSLocationAlwaysUsageDescription
을 삽입 : 여기에 내가했던 것들입니다. 위치 업데이트가 선택된 기능의 백그라운드 모드를 활성화했습니다. 매우 유명한 블로그 post에서 도움을 얻으십시오. 위치 액세스 요청 팝업을 수신하고 앱이 위치에 액세스하도록 허용합니다.
하지만 위치 업데이트를 관리 할 수 없습니다. IOS 8에서는 IPAD에서 작동하지만 IOS 버전 9.3.2에서는 ipad에서 작동하지 않습니다. IOS 9.3.2에서 어떻게 위치 업데이트가 작동합니까?
: 여기에 세부 검사의 답을
? –
@Ronak Chaniyara 질문이 업데이트되었습니다. kCLErrorDenied가 발생했습니다 (오류 도메인 = kCLErrorDomain 코드 = 0 "(null)") – Murat