Tim
Tim

Reputation: 9042

Peer-to-peer communication between iOS devices

I am trying to prototype a solution to a problem and am currently exploring multiple routes I could try. Is it possible for one iOS device, running a certain app, to communicate directly with another iOS device, running the same application - without the need to be on the same LAN?

Solutions I am currently investigating are using Bluetooth and ad-hoc wireless connections.

Ideally, the application when installed would ask the user for the required permissions, and then would accept and/or send data to/from another client after a handshake had happened.

My concern with Bluetooth is that 'pairing' would need to happen with every device, rather than happen in the background once the user has installed the app. I have a feeling what I am talking about isn't possible from what I've been reading elsewhere on Stackoverflow.

Upvotes: 0

Views: 5593

Answers (4)

Ashif Khan
Ashif Khan

Reputation: 9

From the documentation of MultipeerGroupChat: MultipeerGroupChat sample application utilizes the Multipeer Connectivity framework to enable nearby users to discover, connected, and send data between each other. This sample simulates a simple chat interface where up to 8 devices can connect with each other and send text messages or images to each other. Here you will learn how to bring up framework UI for discovery and connections and also how to monitor session state, listen for incoming data and resources, and send data and resources.

This is an excellent example at developer.apple.com here is the link https://developer.apple.com/library/ios/samplecode/MultipeerGroupChat/Introduction/Intro.html

Also this tutorial from Ralf Ebert demonstrates how to use Multipeer Connectivity framework for peer communication should help you. https://www.ralfebert.de/tutorials/ios-swift-multipeer-connectivity/

Upvotes: 0

Laura
Laura

Reputation: 585

Depending on what you need to communicate, you could try checking out this project, which lets you share arrays of strings between iOS devices over Bluetooth LE.

You don't need to "pair" the devices and it can still communicate while the app is in the background. SimpleShare

Hope it helps!

Upvotes: 0

Jacob R
Jacob R

Reputation: 430

Take a look at Bluetooth Low Energy.

https://developer.apple.com/library/ios/#samplecode/BTLE_Transfer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40012927

Here is another example,

https://github.com/KhaosT/CBPeripheralManager-Demo

You might also want to look into GameKit and peer-to-peer connectivity there.

Upvotes: 2

charleyh
charleyh

Reputation: 2063

I can't tell you anything about it, but you might try looking at iOS 7. If that's an option, I'd take a look. Can't talk about what it is because of NDA though.

Upvotes: 2

Related Questions