Bluetooth/WiFi between Mac app and iOS app

Solutions Collect From Internet About “Bluetooth/WiFi between Mac app and iOS app”

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:
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)