Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exchange strings between Mac OS X and iOS via Bluetooth

For a project, I have to send informations such as strings or ints from an iOS app (on iPhone 5) to a Mac OS X app (on a MacBook Pro), while both the iPhone and the MacBook Pro are in place without Wifi. The obvious solution is using Bluetooth. So the question is: Can I do that, and how?

like image 776
user2162044 Avatar asked Nov 18 '25 10:11

user2162044


1 Answers

You should use the CoreBluetooth framework.

For Mac: you'll need either a Macbook Air or Mac-mini

For iOS: you'll need an iPhone 4s, iPhone 5, iPad 3, iPad 4, or new iPod touch.

--A short overview:

You'll need to host both the CBCentralManager and the CBPeripheralManager on one device, and then host just the CBPeripheralManager on the other device.

The CBCentralManager is responsible for connecting and maintaining connections to external devices.

The CBPeripheralManager is responsible for writing and reading from those connections.

You can either send a write/read request or you can advertise a custom CBService that contains a CBCharacteristic with your string/int value.

Look at the header files and docs because there are tons of methods you need to adopt. There's also really good WWDC2012 videos that illustrate these methods in depth.

(However, if you want to use just a Macbook Pro, you'll need to use the standard IOBluetoothFramework on Mac and external accessory framework on iOS )

like image 152
Tommy Devoy Avatar answered Nov 20 '25 00:11

Tommy Devoy