14

I am looking for a way to have one iPhone app send a message to another app on a different phone (sort of like a Sender-Receiver set up). I am looking for the best possible way to do this. Does anyone have any ideas and/or tutorials?

Thanks for the help.

Felix
  • 35,354
  • 13
  • 96
  • 143
user1205480
  • 161
  • 1
  • 1
  • 4

3 Answers3

17

You should use GameKit. It is super easy to send messages between two iOS devices using it. Here's a great tutorial: Game Kit. You can also get more information about it here from the docs: About Game Kit.

You communicate by creating an ad-hoc bluetooth or local wireless network.

Imirak
  • 1,323
  • 11
  • 21
4

lmirak provided insightful info about device communication(especially about GameKit). I would like to add one more solution. You can use WiFi network to do your device communication.

See the link or download the sample application from developer.apple

The sample application named as WiTap. It demonstrates how to achieve network communication between applications. Using Bonjour, the application both advertises itself on the local network and displays a list of other instances of this application on the network.

Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102
0

If your app is only going to run on iOS, then you should use the fantastic MultipeerConnectivity library. https://developer.apple.com/documentation/multipeerconnectivity


If you need a solution that will work cross-platform, then one way to accomplish this is using sockets and connecting over a local network. On iOS you can use CocoaAsyncPods for sockets and NetService for discovery.

Here is a basic example app that does this: https://github.com/brendaninnis/LocalNetworkingApp , which I explain in great detail here: http://brendaninnis.ca/connect-nearby-devices-part-1.html

InnisBrendan
  • 2,079
  • 2
  • 19
  • 21