• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

ユーザーが設定でロケーションの設定をいぢると、

didFailWithError

が呼ばれる。Grant したときでさえも code = 0 で呼ばれる!

ユーザーが設定でロケーションの許可を与えなかったとき、だからといってstopUptatingLocation を呼んでしまうと、その後許可を与えたことがわからなくなる。ネットの例はこれが多いので注意。

   1  -	(void)
   2  locationManager:(CLLocationManager*)pLM
   3  didFailWithError:(NSError*)pError
   4  {	assert( [ pError.domain isEqual:kCLErrorDomain ] );
   5  	switch ( pError.code )
   6  	{
   7  	case  0:	//	User grant permission to access Location.
   8  		break;
   9  	case  1:	//	User change permittion to access Location to disabled, needs to uLocation be nil.
  10  	default:	//	But don't stop update location, you can't come back when user granted permission to access Location.
  11  		uLocation = nil;
  12  		break;
  13  	}
  14  }

posted by Face Saturn on Mon 14 Apr 2014 at 17:44
Contents
UILocationManager
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ