0

以下のコメントを読んでいました。

「「省電力」モードが何を意味するのかわかりませんが、画面がロック/オフになっているときを考えている場合、アプリがまだ実行されている場合、Core Location の実行は停止しません。 Core Location を使用するアプリの実行中に携帯電話をロックすると、新しい位置情報データが利用可能になると携帯電話がアプリを更新し続けるため、携帯電話のバッテリーが予想よりもはるかに早く消耗します.これを回避することができます.をリッスンしUIApplicationWillResignActiveNotificationて画面ロックを検出し、UIApplicationDidBecomeActiveNotificationロック解除を検出することにより、アプリケーションで。」

コア ロケーションを使用するアプリがあり、電話がロックされていない限り、コア ロケーションから通常の NSlog エントリを取得します。ただし、ロックした瞬間、コアロケーションからの NSlogs は、電話をウェイクアップするまで停止します。ロギングを行う私のコードは次のとおりです。

-(void) locationManager:(CLLocationManager *)manager 
 didUpdateToLocation:(CLLocation *)newLocation 
     fromLocation:(CLLocation *)oldLocation {

 if (startingPoint == nil) 
  self.startingPoint = newLocation;

 userLocation.latitude = newLocation.coordinate.latitude;
 userLocation.longitude = newLocation.coordinate.longitude;

 NSLog(@"Update from LM: Latitude = %f",newLocation.coordinate.latitude);
 NSLog(@"                Longitude = %f",newLocation.coordinate.longitude);

}

何か不足していますか?

4

1 に答える 1

0

That looks like part of a response that I wrote to a question over a year ago. See my comment there about it.

For future reference, if you're going to write a response to an answer, you shouldn't create a new question. Stack Overflow has a comment feature that's designed for this purpose. Saying "your comment" with no context at all is asking for confusion (I just happened to read Stack Overflow today, or I wouldn't have noticed).

于 2010-02-24T04:09:00.393 に答える