I have iBeacon that have known UUID. If I search for this beacon from Android device - I can see exact this UUID.
But when I search for this iBeacon from iOS device it can't be found with this UUID. I found peripheral with identifier that differs from UUID.
func centralManagerDidUpdateState(_ central: CBCentralManager) {
let serviceUUID: CBUUID = CBUUID(string: "e2c56db5-dffb-48d2-b060-d0f5a71096e0")
central.scanForPeripherals(withServices: [serviceUUID], options: nil)
}
Why are they different? What can I do to search peripheral with known UUID?
I suspect that what you are "discovering" on Android is not the ProximityUUID of an iBeacon, but a different kind of UUID (e.g. GATT Service as Larme suggests in his comment.) There are many different UUIDs that are used for different things with Bluetooth. The one you want for iBeacons is called the Proxmity UUID.
You can try to see the Proximity UUID by using a dedicated beacon scanner like the Locate App. If you can see the beacon with this app, and it identifies it as an iBeacon you should also be able to detect it with CoreLocation on iOS like this:
You cannot use CoreBluetooth APIs as you have shown to detect iBeacons, because iOS blocks using CoreBluetooth to detect iBeacons. Note also that there are a few more steps to setting up beacon ranging on iOS (requesting permissions, defining a callback method), so check out a tutorial like here.