Here is the solution for iOS (thanks to Larme):
NSArray *connectedAccessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];
:
https://developer.apple.com/library/prerelease/ios/documentation/ExternalAccessory/Reference/EAAccessoryManager_class/index.html#//apple_ref/occ/instp/EAAccessoryManager/connectedAccessories
Also, if anyone needs this, this is the documentation for Mac:
https://developer.apple.com/library/mac/documentation/DeviceDrivers/Conceptual/Bluetooth/BT_Intro/BT_Intro.html
and code snippet for Mac
NSArray *devices = [IOBluetoothDevice pairedDevices];
For the question alan478 BLE:
The basic Bluetooth infrastructure provides the classes required for iOS and Mac applications to communicate with devices equipped with Bluetooth wireless technology. You can watch this lesson:
http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor
and the BLE code snippet:
Please read this document at developer.apple.com:
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/BestPracticesForInteractingWithARemotePeripheralDevice/BestPracticesForInteractingWithARemotePeripheralDevice.html
Here is an interesting paragraph for you:
Explore peripheral device data wisely A peripheral device may have many more services and features than you might be interested in when you design an application to fulfill a specific use case. Detecting all peripheral services and related features can adversely affect battery life and the performance of your applications. Therefore, you should search and discover only those services and related characteristics that you need.
For example, imagine that you are connected to a peripheral device with many services available, but your application only needs access to two of them. You can search and discover only these two services by passing the DiscoverServices method: CBPeripheral class to the array of your service UUIDs (represented by CBUUID objects), for example:
[peripheral discoverServices:@[firstServiceUUID, secondServiceUUID]]
After you find two services that interest you, you can also search and find only those characteristics of these services that are of interest to you. Again just pass an array of UUIDs that identifies the characteristics you want to discover (for each service) the DiscoverCharacteristics: forService: property of the CBPeripheral class method.
There is also this comment:
"I think that Apple forbids this thing. We can get a list of devices with a specific CBUUID, so if you want to list all devices (the same as the Bluetooth settings, initially), then this is not possible. I'm wrong. - Mrug Mar 11 at 13 : 24 "
about this question:
How to get a list of available bluetooth devices?