Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetooth/WiFi between Mac app and iOS app [closed]

How can I make a Bluetooth Mac app that connects with an iOS app and sends messages ?

Or an iOS app that connects with a Mac app via a local WiFi network ?

like image 956
rafa Avatar asked Nov 02 '11 14:11

rafa


People also ask

How do I stop Handoff between iPhone and Mac?

Turn off Handoff on your devices iPad, iPhone, and iPod touch: Go to Settings > General > AirPlay & Handoff. macOS 12.5 or earlier: Choose Apple menu > System Preferences, click General, then deselect “Allow Handoff between this Mac and your iCloud devices.”

Does Handoff work from Mac to iPhone?

Set up HandoffUse Handoff with any Mac, iPhone, iPad, iPod touch, or Apple Watch that meets the Continuity system requirements. Handoff works when your devices are near each other and set up as follows: Each device is signed in to iCloud with the same Apple ID.

How do I disconnect my iPhone from my Mac using Bluetooth?

If you want to permanently disconnect the Bluetooth pairing between these devices, open the Mac's Apple menu, select System Preferences, and select Bluetooth. Follow that by clicking the X-shaped icon next to your iPhone. Then, select Remove.

What happens when Sync iPhone and Mac?

Syncing means transferring items and keeping them up to date between your Mac and your iPhone, iPad, or iPod touch. For example, when you add a movie to your Mac, you can sync so that the movie appears on both your Mac and iPhone. You can sync items including music, movies, TV shows, podcasts, books, and more.


1 Answers

NOTE: this answer is now outdated as with the introduction of CoreBluetooth (Bluetooth LE v4) since iOS6 and OSX 10.7 any iOS device is open to any kind of communication with any other BLE compatible device, either a Mac or PC or external hardware. The answer below is still valid if you cannot support BLE, due to old hw or specific requirements (e.g. required bandwidth)

As far as I know, this is almost impossible. Bluetooth connection between iOS devices is well supported with the GameKit framework but there is no support for connection with other OSes, OSX included. The only connection between Mac and iPHone I have ever seen is with the hotspot feature (when it works). Consider for example the Keynote Remote app. This app allows you to control a Keynote presentation using your iPhone as a remote. It allows this control when the two devices are Keynote-paired on the WiFi, but this connection is not allowed using Bluetooth, while with Bluetooth you can control a Keynote presentation between two iOS devices. And you can find this statement in Apple tech note 2152:

An important consequence of the first point is that Bluetooth peer-to-peer networking can only be used to communicate between iOS devices; you can't use it, for example, to communicate between an iOS device and a computer running Mac OS X.

As far as the WiFi question (I forgot to reply to it in my first question) essentially you to kind of problems to solve: discoverability and data transfer. In order to determine if two devices are in the same network, you can use the Bonjour protocol. Essentially one of the machines publish itself as service-provider for a specific service (you can create your own service: e.g. "_mytype._myprotocol") and the would-be client will search for a server. Besides Bonjour takes care of other things like addressing and DNS without the two apps to know the details of the local network they are in. This is explained in Apple docs here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/NetServices/Articles/about.html Note that Bonjour is at the base of features like AirPlay (Apple TV), AirPrint and probably also AirDrop but it is supported by a lot of devices, e.g. some NAS. In the SampleCodes section of the Apple developers site you will find a great example, called "BonjourWeb" that shows how service discovery works. You can easily try it in your iPhone simulator or device and if you have some Bonjour-enabled device you will see it in the list. The second problem of course is then real data communication between the two devices, is up to you to define a custom client/server or use a standard web-server based approach. This depends on the application and the data flow. The first approach is better as it is highly customized, you must study the NetworkStreams concepts and check out the SimpleNetworkStreams code in the apple library (this is a simple communication app between a Mac and an iPhone; not always working but it is a good starting point)

like image 169
viggio24 Avatar answered Sep 29 '22 09:09

viggio24