先週iBeaconについて知りました。私はAmazonでこのビーコンを買った。 https://www.amazon.com/gp/product/B010Q2PUGA/ref=oh_aui_detailpage_o00_s00?ie=UTF8&psc=1 ライトブルーアプリを使用して、ビーコン情報(UUID、メジャー、マイナーなど)を読み取ることができるので、ビーコンがブロードキャストしていることがわかります。 このチュートリアルの後、私はビーコンのプログラミングに慣れるためのアプリを作った。 (私のUUIDを使って)コードにわずかな変更がありました。私は速いバージョンのためprintlnをprintに変更しなければなりませんでした。 https://willd.me/posts/getting-started-with-ibeacon-a-swift-tutorial 私のアプリは私のビーコンを認識していないようです。私のログ/デバッグ領域では私は以下を参照してください。iOSアプリケーションでビーコンが認識されない
[]
[]
[]
私のコードは次のとおりです。
import UIKit
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
let locationManager = CLLocationManager()
let region = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "8EBB5704-9697-02C9-D073-BF9162B72D7B")!, identifier: "iBeacon-6713")
// let region = CLBeaconRegion(proximityUUID: NSUUID(UUIDString: "8EBB5704-9697-02C9-D073-BF9162B72D7B")!, major: 11046, minor: 11047, identifier: "ibeacon")
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self;
if (CLLocationManager.authorizationStatus() != CLAuthorizationStatus.AuthorizedWhenInUse) {
locationManager.requestWhenInUseAuthorization()
}
locationManager.startRangingBeaconsInRegion(region)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
// print(beacons)
// }
func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
print(beacons)
}
}
のXcode:バージョン7.3.1(7D1014)
OS Xエルキャピタン:バージョン10.11.5 (15F34)
iOS版:バージョン9.3.2(13F69)
アップルスウィフトバージョン2.2(swiftlang-703.0.18.8打ち鳴らす-703.0.31)
返信いただきありがとうございます。残念なことに、ユニットには全くドキュメントがなく、アンドロイドデバイスはありません。 – MWW
まあ、私は私に別のUUIDとメジャーとマイナーの整数値を与えたWindowsアプリケーションを見つけることができました。すべては今働いている!情報をありがとう。 – MWW