0

I need to search nearby by bluetooth device those are classic Bluetooth (Bluetooth 2.1 or later). I searched a lot but there are only library and discussion about the BLE any guidance will help me a lot.

Varun Naharia
  • 5,318
  • 10
  • 50
  • 84
  • 1
    MFI bluetooth device can be found by iOS. For list of available devices check this link: http://stackoverflow.com/questions/20654123/how-to-list-out-all-mfi-devies-into-the-ios-app/20654221#20654221 – brianLikeApple Feb 08 '17 at 09:47

1 Answers1

0

As far as I know, you can't find them until you don't manually pair and connect them. In order to discover the already paired and connected ones, I use this:

import AVFoundation
func example() {
    let session = AVAudioSession.sharedInstance()
    do {
        try session.setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.allowBluetooth)
        if let inputs = session.availableInputs { ... } //should contain bluetooth devices aswell
    }
    catch { print("Failed to set category") }
}

`

Daniel993
  • 31
  • 1
  • 7