J'ai quelques balises avec ce UUID:custume app ios ne peut pas trouver mes balises nrf
0112233445566778899aabbccddeeff0 et majeur = 1 mais leur mineur sont différents.
ceci est une partie du code de firmware qui montre ces chiffres:
#define APP_MAJOR_VALUE 0x01, 0x02 #define APP_MINOR_VALUE 0x03, 0x04
#define APP_BEACON_UUID 0x01, 0x12, 0x23, 0x34, \
0x45, 0x56, 0x67, 0x78, \
0x89, 0x9a, 0xab, 0xbc, \
0xcd, 0xde, 0xef, 0xf0
static uint8_t m_beacon_info[APP_BEACON_INFO_LENGTH] =
{
APP_DEVICE_TYPE,
APP_ADV_DATA_LENGTH,
APP_BEACON_UUID,
APP_MAJOR_VALUE,
APP_MINOR_VALUE,
APP_MEASURED_RSSI
};
et ceci est mon code rapide:
import UIKit
import CoreLocation
import CoreBluetooth
class HomeViewController: UIViewController, CLLocationManagerDelegate {
var locationManager: CLLocationManager!
var managerBLE: CBCentralManager?
override func viewDidLoad() {
super.viewDidLoad()
managerBLE = CBCentralManager(delegate: nil, queue: nil, options: [CBCentralManagerOptionShowPowerAlertKey: true])
locationManager = CLLocationManager()
locationManager.delegate = self
if CLLocationManager.authorizationStatus() == .authorizedWhenInUse {
locationManager.requestWhenInUseAuthorization()
}
startScanning()
}
func startScanning() {
let beaconRegion = CLBeaconRegion(proximityUUID: UUID(uuidString: "your UUID")!, major: 1, identifier: "MyBeacon")
locationManager.startRangingBeacons(in: beaconRegion)
}
func locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion) {
if beacons.count > 0 {
for beacon in beacons {
updateDistance(beacon.proximity)
if beacon.proximity == .near {
// run your code
}else if beacon.proximity == .far {
// run your code
}
}
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
mais quand j'instaall mon application sur mon iPhone fondamentalement rien ne se passe. Je n'ai aucune idée de ce que je fais mal?
J'ai fait ce que vous me demandez, mais rien ne se passe . J'ajoute une réponse moi-même, pour expliquer plus de détails. Pourriez-vous vérifier et lemme savoir ce que vous en pensez? – user6485186
Voir ma modification avec une suggestion supplémentaire. – davidgyoung