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?
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 )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With