LoginSignup
1
1

More than 5 years have passed since last update.

ios8でiBeaconさわってみたときのメモ

Last updated at Posted at 2014-11-08

環境

MacOSX 10.10
iBeaconサンプル http://d.hatena.ne.jp/shu223/20130924/1379990718 」 をお借りしました

iBeaconサンプルのiOS8対応

iOS7では、上記のサンプルコード動いたけど、iOS8から別対応が必要なようです。大きく分けると下記の2件

1:info.plistに追加

  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysUsageDescription

上記を追加

これは、ユーザにアラート出した際にだす説明文

  • NSLocationWhenInUseUsageDescription:起動中のみ
  • NSLocationAlwaysUsageDescription:バッググランドでもよぶ

IMG_0435_1024.jpg

IMG_0436_1024.jpg

2:ユーザにアラートを出して、使用許可をもらう

test.m
self.locationManager =  [CLLocationManager new];
[self.locationManager requestAlwaysAuthorization];

上記の2行目コードがいるっぽい。「requestAlwaysAuthorization」メソッドは、バッググランドでも使用する許可を促すアラートを表示

以上

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1