ビーコンに最も近いときに画像を表示し、別のビーコンに移動すると別の画像を表示するビーコンに関する私のプロジェクト。if ステートメントを使用してこの問題を解決しようとしています。何をすべきかわかりません。エラーが表示されます。
func locationManager(manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], inRegion region: CLBeaconRegion) {
if BEACON_1_UUID = BEACON_1_MAJOR {
var closestBeacon = beacons[0]
// print("major = \(closestBeacon.major) minor = \(closestBeacon.minor)")
if closestBeacon != lastFoundBeacon || lastProximity != closestBeacon.proximity {
lastFoundBeacon = closestBeacon
lastProximity = closestBeacon.proximity
var proximityMessage: String!
switch lastFoundBeacon.proximity {
case CLProximity.Immediate:
if BEACON_1_MAJOR = closestBeacon {
proximityMessage = "Very Close"
txtDesc.text = "hi"
imageview.image = UIImage(named: "CC_Zoe-Francois_No-Bake-Strawberry-Cheesecake.jpg");
self.checkIn("Leaving", comment: "Checking In")
self.view.backgroundColor = UIColor.redColor()
txtre.text! += "Very Close to \(closestBeacon.major) \(closestBeacon.minor) \n"
} else { /* ... */ }
case CLProximity.Near:
proximityMessage = "Near"
// manager.stopRangingBeaconsInRegion(bRegion)
self.view.backgroundColor = UIColor.orangeColor()
txtre.text! += "Near \(closestBeacon.major) \(closestBeacon.minor) \n"
case CLProximity.Far:
proximityMessage = "Far"
txtre.text! += "Far from \(closestBeacon.major) \(closestBeacon.minor) \n"
self.view.backgroundColor = UIColor.greenColor()
//self.checkIn("out")
self.sendNotification("Good Bye")
default:
proximityMessage = "Where's the Beacon?"
}
}
}
}