- Learning iBeacon
- Craig Gilchrist
- 257字
- 2021-08-05 17:16:54
Testing our code
Plug in an iOS device to your Mac, and compile and debug the app. You should be presented with a lovely blank white screen. Because we're using CoreLocation
, you need to give permission for the app to use your location. It's important that you agree to this:

Location permission dialog
Now, open the companion app on your Mac and choose the beacon profile named Chapter 1 : Default Beacon from the list on the left-hand side and then click on the power button, as shown in the following screenshot:

Using your Mac to broadcast your first iBeacon
What you've just simulated is your device entering a region. If this was a real scenario, the beacon would have been running all along and your device would come into range because you walk towards the beacon, but the companion app serves just as well in this instance.
If all was successful, you should see the following screenshot:

Successfully entered the region
Finally, test exiting the region by turning the beacon profile off in the companion OS X app. It may take up to 30 seconds for the app to register that you've left the region. Once the event fires, you should see the following screenshot:

Successfully exited the region
Tip
The reason for the delay is that the didExitRegion
method is meant for tidying up resources after ranging beacons, which we'll cover in the later chapters. Apple's implementation includes a delay to ensure the event isn't fired when the Bluetooth signal may be subject to interference.
- Application Development with Qt Creator(Second Edition)
- 面向物聯網的CC2530與傳感器應用開發
- 重新定義Spring Cloud實戰
- Oracle SOA Suite 11g Performance Tuning Cookbook
- 計算機網絡工程實用教程(第2版)
- 世界互聯網發展報告·2019
- 區塊鏈輕松上手:原理、源碼、搭建與應用
- 網絡安全應急響應技術實戰
- 6G新技術 新網絡 新通信
- Microsoft Dynamics CRM 2011 Applications(MB2-868) Certification Guide
- 紅藍攻防:構建實戰化網絡安全防御體系
- 深入理解OpenStack Neutron
- 網絡利他行為研究:積極心理學的視角
- 計算機網絡技術
- SEO攻略:搜索引擎優化策略與實戰案例詳解