I would like to do data sharing(Maybe xml or json file) between 2 iOS devices (iPhone or iPad) and communication would be like "one to many bidirectional" bases at a time.

With some experience and from articles , I have found below ways to do it.

  1. Wi-Fi Direct
  2. AirDrop
  3. Bluetooth(By creating Master and Slaves)
  4. Bonjour SDK.
  5. Bump API(Which is already closed from january 2014)

Could anybody please suggest the best way to fulfill my requirement, which is a good way to do it?

有帮助吗?

解决方案

Since IOS 7 Multipeer Connectivity could also be quite interesting.

The Multipeer Connectivity framework provides support for discovering services provided by nearby iOS devices using infrastructure Wi-Fi networks, peer-to-peer Wi-Fi, and Bluetooth personal area networks and subsequently communicating with those services by sending message-based data, streaming data, and resources (such as files).

Here is a nice tutorial about implementing a file sharing system using multipeer connectivity: http://www.appcoda.com/intro-ios-multipeer-connectivity-programming/

其他提示

Wi-Fi Connecting to your Personal Hotspot via Wi-Fi is the default option provided by Apple, since you have to specifically accept if you also want to enable the Bluetooth connection. A Wi-Fi connection provides:

Pros

High throughput: Throughput via Wi-Fi Personal Hotspot can be of around 30 Mbps between two devices and even more. Faster: Connecting via Wi-Fi tends to be quite faster than connecting via Bluetooth.

Cons

Might need you to reconnect every time: Wi-Fi tends to be unstable and to turn itself off every time you put your iPhone to sleep. This means that you have to take out your iPhone and re-enable the Personal Hotspot if you want to connect. Time limit: Perhaps the biggest drawback of using a Wi-Fi Personal Hotspot with your iPhone is that in order to minimize power consumption, your iPhone only gives you a short while (90 seconds reportedly) to connect a device to it after you enable Wi-Fi Personal Hotspot. If you take longer than that, you are forced to enable the option again. More power consumption: The Wi-Fi Personal Hotspot consumes more power than its Bluetooth counterpart, which is also part of the reason it only gives you a short while to connect a device. A bit more complex: The iPhone’s Wi-Fi Personal Hotspot requires you to enter a password and to configure your own security options.

Bluetooth

Contrary to the Wi-Fi connection, using your Personal Hotspot via Bluetooth offers some key advantages and one huge drawback:

Pros

No time limit: Once you enable Bluetooth Personal Hotspot, there is no time limit for you to connect your device to your iPhone. Automatic pairing: Bluetooth remains dormant and ready to connect to your devices the moment you wake them up. Additionally, Bluetooth is more power-efficient than Wi-Fi. Security handled automatically: The security level of a Bluetooth Personal Hotspot is equivalent to Wi-Fi’s WPA2, and it is all handled transparently from the moment you connect to it.

Cons

Very limited throughput: Without a doubt the biggest drawback of using a Bluetooth Personal Hotspot is its limited throughput, which can be of just 3 Mbps at the most, making it 10 times less than what your Wi-Fi Personal Hotspot can offer.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top