2017-10-26 2 views
1
// Create a location manager object 
self.locationManagerTest = [[CLLocationManager alloc] init]; 

// Set the delegate 
self.locationManagerTest.delegate = self; 

// Request location authorization 
[self.locationManagerTest requestAlwaysAuthorization]; 

// Specify the type of activity your app is currently performing 
self.locationManagerTest.activityType = CLActivityTypeOtherNavigation; 

// Start location updates 
[self.locationManagerTest startUpdatingLocation]; 

答えて

1

1.after 2を助けましたリンゴのドキュメントに行くだけでした。私はちょうど2つの行を追加するだけでした:

self.locationManagerTest = [[CLLocationManager alloc] init]; 
// Set the delegate 
self.locationManagerTest.delegate = self; 
// Request location authorization 
[self.locationManagerTest requestWhenInUseAuthorization]; 
// Set an accuracy level. The higher, the better for energy. 
self.locationManagerTest.desiredAccuracy = kCLLocationAccuracyThreeKilometers; 
// Enable automatic pausing 
self.locationManagerTest.pausesLocationUpdatesAutomatically = NO; 
// Specify the type of activity your app is currently performing 
self.locationManagerTest.activityType = CLActivityTypeFitness; 
// Enable background location updates 
self.locationManagerTest.allowsBackgroundLocationUpdates = YES; 
// Start location updates 
[self.locationManagerTest startUpdatingLocation]; 
1

/位置情報の更新 とのInfo.plistをオンにこのキーを追加し、「個人情報保護 - ロケーション必ず使用方法の説明」 希望これは、この問題に苦しんで数週間が最終的に解決

関連する問題