I want to receive RSSI of iBeacon on my iOS application this code can run on iOS12. Now I have updated to iOS 13 this code can't run.
and alert
'init(proximityUUID:identifier:)' was deprecated in iOS 13.0 'startRangingBeacons(in:)' was deprecated in iOS 13.0 'stopRangingBeacons(in:)' was deprecated in iOS 13.0
How to fix this problem?
If you look at the documentation for the method your are using it tells you that it was deprecated in iOS 13 and also tells you what to use instead.
In case the link breaks, this is the alternative option:
init(uuid:major:minor:identifier:)
Check the documentation for the other methods and it will tell you which alternatives to use.
Now.. to configure your app to switch between methods based on the iOS version you can use an @available check..
if #available(iOS 13, *) {
// use the shiny new one
} else {
// use the old one
}
After reading the docs I changed my code from:
let beaconRegion = CLBeaconRegion(proximityUUID: uuid, major: 123, minor: 456, identifier: "MyBeacon")
To:
let beaconRegion = CLBeaconRegion(uuid: uuid, major: 123, minor: 456, identifier: "MyBeacon")
and resolved the first issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With