Bluetooth connection between 2 iOS devices

前端 未结 3 1276
囚心锁ツ
囚心锁ツ 2020-12-08 17:16

I am trying out Core Bluetooth framework introduced in iOS 5.0. According to many threads (one of many) on StackOverflow itself:

  1. Core Bluetooth framework can b
相关标签:
3条回答
  • 2020-12-08 17:31

    Well, my understanding of Bluetooth Low Energy (BLE) general was poor. As the accepted answer pointed out, one device has to act as Central and other one has to act as peripheral for communication to take place.

    A good example source code for iOS to iOS and iOS to Mac OS BLE communication is here.

    Some important points to consider

    1. on iOS 5.0 -> iPhone can only act as Central, so communication between 2 iOS devices is not possible.
    2. on iOS 6.0 -> iPhone can act as peripheral too.. So for communication to take place, atleast one device has to be running on iOS 6.0 (and probably later).
    3. First iPhone device with BLE hardware added is iPhone 4S. So even if iPhone 4 can run iOS 5 ,BLE communication is not possible on it.

    Well some information..

    0 讨论(0)
  • 2020-12-08 17:34

    As spamsink commented, one device needs to act as peripheral, and one as central in order for them to communicate.

    There is a great sample app from Apple that does that. Also, check out WWDC 2012 sessions 703 - CoreBluetooth 101 and 705 - Advanced CoreBluetooth for great explanation and examples of CoreBluetooth framework usage.

    Also note, for device to be in peripheral mode, it needs to be updated to iOS 6.0 or later.

    0 讨论(0)
  • 2020-12-08 17:35

    if you call scanForPeripherals function in didUpdateState delegate then it works because delegate functions can't return.

    0 讨论(0)
提交回复
热议问题