私はappleのiBeaconフレームワークを使用し、近接しているすべてのbluetooothデバイスのリストをコンソールに記録しようとするネイティブアプリを開発中です。私はthis tutorialに従っていますが、私はアプリケーションを実行するときに何もコンソールに印刷されません。私のエラーはどこですか?ビーコンのデータを表示
以下は、私が書かれているビューコントローラファイルの完全な詳細です:
import UIKit
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
let locationManager = CLLocationManager()
let region = CLBeaconRegion(proximityUUID: NSUUID(uuidString: "852c0828-fe67-4dd7-b8ff-52852a66851e")! as UUID, major: 8008, minor: 1337, identifier: "Testing")
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
locationManager.delegate = self
if (CLLocationManager.authorizationStatus() != CLAuthorizationStatus.authorizedWhenInUse) {
locationManager.requestWhenInUseAuthorization()
}
locationManager.startRangingBeacons(in: region)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
print(beacons)
print("hello")
}
}
は何も「こんにちは」を含め、実行時にコンソールに出力されません。