Reputation: 31
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?
Upvotes: 3
Views: 1200
Reputation: 585
This project should help you with the iOS side of sharing strings over Bluetooth: SimpleShare
It lets you easily send and receive arrays of strings from your iOS device over Bluetooth LE. You'd just need to manage the CBCentralManager on the Mac.
Upvotes: 0
Reputation: 13549
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 )
Upvotes: 6