Communication between two iOS devices
Asked Answered
I

3

15

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.

Ironic answered 9/7, 2012 at 20:4 Comment(3)
Locally or remote? In other words, are the two devices in the same room, or anywhere on the planet?Worlock
@user1205480:please describe your question well. else others can't identify what you are looking for.Seaquake
The phones are in the general area, i.e. same building.Ironic
B
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.

Bedfordshire answered 9/7, 2012 at 20:9 Comment(3)
The tutorial above worked PERFECTLY. I had a working prototype in less than 5 minutes.Fossette
How much overhead in terms of memory does GameKit introduce? (IMHO this is always something that you should ask yourself when using a 3rd party library.)Denten
The first link is dead. The second link works badly on iOS; can't tell if that's the content or my device.Heilner
S
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.

Seaquake answered 10/7, 2012 at 5:45 Comment(0)
A
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

Annulment answered 17/11, 2019 at 1:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.