在我的應用程序中,我實現了Cllocation管理器以使用當前用戶位置&,它工作正常。但是當應用程序在後臺輸入或終止時,GPS位置圖標會自動隱藏在iPod中。當我嘗試與iPhone相同時,圖標不會隱藏。Gps位置圖標未關閉
所以,我找不到任何解決方案。幫我!!
我的代碼如下:
AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
if(locationManager == nil)
locationManager =[[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy= kCLLocationAccuracyBest;
self.locationManager.distanceFilter= 5;
[locationManager startUpdatingLocation];
[locationManager startUpdatingHeading];
}
-(void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
self.userLocation=newLocation;
[self.locationManager startMonitoringSignificantLocationChanges];
}
Map.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
[APPDELEGATE.locationManager startUpdatingLocation];
}
- (void)viewWillAppear:(BOOL)animated
{
self.map.delegate = self;
[self.map setShowsUserLocation:YES];
}
如果我手動對我的iPod應用程序的位置服務,當應用程序是關閉,它沒有顯示位置圖標。但是,當我嘗試在iPhone中相同,它顯示位置圖標。