Polaris Nation
Polaris Nation

Reputation: 1225

iBeacon should needs bluetooth in Swift?

I know that Bluetooth function is necessary to use that function. However, even if I turn off Bluetooth for a while in the current project, the print items below are still being updated.

func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {

        if beacons.count > 0 {

            print("if beacon detect " + String(beacons.count))

            majorArray.removeAll()

            for beacon in beacons {
                //                print("uuid: \(beacon.proximityUUID.uuidString) major: \(beacon.major) minor: \(beacon.minor)")


                let major = "\(beacon.major)"
                let num = (major as NSString).integerValue

                if !majorArray.contains(num){
                    majorArray.append(num)

                }

            }

        }else{

            print("no beacon result")

        }

    }

I'm going to search for a device near me, if I do that it need Bluetooth. I don't know why this is happening when I turn off Bluetooth.

If I scan the beacon by ranging, it doesn't need bluetooth?

Upvotes: 0

Views: 178

Answers (1)

davidgyoung
davidgyoung

Reputation: 64916

As of iOS 11, turning off bluetooth in Control Center does not stop beacon detections. (Control Center is the quick menu you see when you swipe up from the bottom of the screen.) This menu item doesn't really turn off bluetooth, it only kills active Bluetooth connections and prevents new ones from being established. It does not prevent connectionless bluetooth communications like beacons.

However, if you turn it off in Settings -> Bluetooth -> Off, you will see beacon detections stop.

Upvotes: 3

Related Questions