UPDATE:
Unfortunately I was not able to get the audio to work from the iPhone so I moved to the mac and attempted to establish the connection from there. Immediately I noticed that there is no AVAudioSesion object available on OSX!
I read up on the documentation for the CoreBluetooth, CoreAudio and IOBluetooth APIs. I was able to use a IOBluetoothDevicyInquiry Object to find the iPhone, then create an IOBluetoothHandsFreeDevice.
How to:
Add IOBluetoothDeviceInquiryDelegate and IOBluetoothHandsFreeDeviceDelegate to the NSViewController.
Create the IOBluetoothDeviceInquiry object within the viewDidLoad method with self as the delegate and start the inquiry.
Define the deviceInquiryDeviceFound and deviceInquiryComplete functions inside of the NSViewController class for callback.
The deviceInquiryDeviceFound function stops the inquiry and the deviceInquiryComplete function creats the IOBluetoothHandsFreeDevice object with the iPhone as the device.
At this point I was able to call the connect method defined in the IOBluetoothHandsFree (IOBluetoothHandsFreeDevice inherits from IOBluetoothHandsFree) to establish a baseband connection between the iPhone and the Mac.
Heres where I’m stuck…
The IOBluetoothHandsFree.connect method documentation states:
“Connects to the device and sets up a service level connection (RFCOMM channel). Delegate methods will be called once the connection is complete or a failure occurs.”
It claims to establish the RFCOMMChannel but I cannot find any pointers to the channel from within the IOBluetoothHandsFreeDevice or the parent classes.
I added the IOBluetoothRFCOMMChannelDelegate to the NSViewController in hopes that it would callback from the connect method with the rfcommChannelOpenComplete and rfcommChannelData methods but alas nothing.
On the audio side:
I believe that if I can get access to the data pointer from the RFCOMMChannel then I can create an AVAudioPlayer object with the data as the source…BUT I want to send audio data from the mac to the iPhone not the other way around.