Connecting iOS a set of iOS devices with Wifi network - ios

I'm searching a new way to sync data between iOS devices connected to the same Wi-fi network.
My app uses iCloud to sync its CoreData UIManagedDocument, but iCloud latency is too big for my goals.
Is there some way to connect iOS devices in the same Wi-Fi network with the iOS SDK? Any ideas?
Thanks

Any two IP-capable devices can connect to each other using BSD sockets - I've written an Objective-C wrapper to facilitate networking operations like this - here it is.

From iOS 7, you should look into the Multipeer Connectivity Framework. It allows connections between iOS devices on the same Wi-Fi network or Bluetooth personal area network, and the API is extremely simple to use.

You can use Gamekit to connect with both WiFi and Bluetooth and send data back and forth.
There's an excellent but lengthy tutorial here http://www.raywenderlich.com/12735/how-to-make-a-simple-playing-card-game-with-multiplayer-and-bluetooth-part-1
you should be able to pick out all the connectivity bits.

Related

Communicate iOS with ODB 2

I need to create an app read info from the ODB2 device installed in a car and show the data to the user but in a "funny" way. So I need to read the data and connect the phone to internet simultaneously.
I found this questions:How to communicate with OBD II using bluetooth or wifi using iphone , but is from 2014, maybe now there is something.
I've been looking for an ODB2 device that can communicates with iOS via Bluetooth.
I found a couple of devices that can do the trick (like viecar or bluedriver), but using their own apps. Also, I found some devices that can talk with iOS via WiFi, but it would be annoying to be connecting your device to WiFi, then turning off WiFi and using mobile data again...
So my questions is:
Is it there any way to communicates via bluetooth with an ODB2 devices? Or better said, is it there any ODB2 device that can be used via Bluetooth with iOS?

Wi-Fi Direct and iOS Support

I want to use Wi-Fi Direct in a solution, but I'm unsure which platforms support it.
Does Wi-Fi Direct depend on iPhone/iOS version?
Can I develop an application with Wi-Fi Direct feature on a iPhone 4s with iOS 8.
It took me a while to find out what is going on, but here is the summary. I hope this save people a lot of time.
Apple are not playing nice with Wi-Fi Direct, not in the same way that Android is. The Multipeer Connectivity Framework that Apple provides combines both BLE and WiFi Direct together and will only work with Apple devices and not any device that is using Wi-Fi Direct.
https://developer.apple.com/library/ios/documentation/MultipeerConnectivity/Reference/MultipeerConnectivityFramework/index.html
It states the following in this documentation - "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)."
Additionally, Wi-Fi direct in this mode between i-Devices will need iPhone 5 and above.
There are apps that use a form of Wi-Fi Direct on the App Store, but these are using their own libraries.
The official list of current iOS Wi-Fi Management APIs
There is no Wi-Fi Direct type of connection available. The primary issue being that Apple does not allow programmatic setting of the Wi-Fi network SSID and password. However, this improves substantially in iOS 11 where you can at least prompt the user to switch to another WiFi network.
QA1942 - iOS Wi-Fi Management APIs
Entitlement option
This technology is useful if you want to provide a list of Wi-Fi networks that a user might want to connect to in a manager type app. It requires that you apply for this entitlement with Apple and the email address is in the documentation.
NEHotspotHelper
MFi Program options
These technologies allow the accessory connect to the same network as the iPhone and are not for setting up a peer-to-peer connection.
Wireless Accessory Configuration (WAC)
HomeKit
Peer-to-peer between Apple devices
These APIs come close to what you want, but they're Apple-to-Apple only.
NSNetService
Multipeer Connectivity
WiTap Example Code
iOS 11 NEHotspotConfiguration
Brought up at WWDC 2017 Advances in Networking, Part 1 is NEHotspotConfiguration which allows the app to specify and prompt to connect to a specific network.
According to this thread:
The peer-to-peer Wi-Fi implemented by iOS (and recent versions of OS
X) is not compatible with Wi-Fi Direct.
Note Just as an aside, you can
access peer-to-peer Wi-Fi without using Multipeer Connectivity. The
underlying technology is Bonjour + TCP/IP, and you can access that
directly from your app. The WiTap sample code shows how.

Does iOS Multipeer connectivity work with non-smartphone devices?

Our guys in the field use equipment that have wifi and Bluetooth connectivity. One of our users has been using a non-iPhone (I guess Android) to transfer files between his phone and the equipment through Bluetooth. However, in switching our users to iPhones to use other enterprise apps we have discovered what some of you already know: iOS's Bluetooth connectivity is severely limited (i.e. no SPP protocol).
The equipment also communicates via wifi, so I was wondering if it's possible to create an app using iOS Multipeer connectivity to solve the Bluetooth problem. All I am finding about this, though, doesn't show anything but phone-to-phone multipeer connections, and not phone-to-machine multipeer connections.
At this point I know nothing about how the field equipment works; that's something I'll have to learn if we decide to pursue this. But assuming that it is capable of discovering wifi networks, would it be able to see the iPhone's network without needing any special software?
Or would I be wasting my time trying to figure this out?
Thanks!
If the equipment is using Bluetooth SPP then unless it is MFi certified you can pretty much forget about connecting to it from iOS. Multipeer connectivity won't do it, that's for sure.
WiFi may be a possibility - you need to get the iPhone and the equipment on the same WiFi network - you can't do this via an app though - you would need to use the WiFi settings in iOS - You will need to learn more about the equipment to see if that is possible.
Short answer: no. Only iOS 7.0+ or MacOS Yosemite+
MultipeerConnectivity is a framework for iOS and Mac OS. To send data using it, you need both devices to have iOS or MacOS with MultipeerConnectivity. You don't have any network-related parameters like "I prefer using bluetooth or wi-fi", it was designed to "just work out of box with simple goal - discover and connect other devices with MultipeerConnectivity.
It means that you can't send data from iPhone with MC to Android or Symbian or old iPhone with iOS <7 etc.
Before iOS7 you could use GameKit, but the logic is the same: both peers need to use GameKit.
If your custom equipment does not have iOS - you need to use lower-level API, and your options include generic Bonjour (NSNetService on iOS device and something Bonjour-compatible on custom device) or CoreBluetooth (obviously bluetooth-only, no wi-fi peer-to-peer) on the lowest level, using sockets and so on.

Multipeer Connectivity range and non ios device

I just started coding Multipeer connectivity with objective c in xcode. I have a few questions about the basics.
What is the range with Multipeer Connectivity? So if I make a chat program, will the two devices only be able to communicate if they are on the wifi network, or will they still be able to communicate if they are across the globe?
Will the program work with an ios device and a non ios device, so they can send each other messages? If yes, are there any extra methods or code that I need to add?
Thanks
As far as I understand MPC works over bluetooth and wifi- so if you are on a home wifi network, or a University campus network, your peers should be able to see one another. MPCis not for using across the globe that I know of...
This is an iOS technology only, iBeacon works across multiple platforms (iOS, android).
But, depending on what you want, you could make your app use internet to go across the globe, and you might be able to use straight bluetooth to connecto to a non-iOS device, then hook into MPC.
I would like to add to Keith's answer above that MPC supports peer-to-peer Wifi as well. This means that the devices involved don't need to be connected to an access point to talk to each other.
Also, the framework protects the developer (and end user) from the underlying technology (bluetooth, WIFI, P2P WIFI) used. In a given "session" between any number of devices (currently only up to 8 supported), each device could be using a different technology to talk to the others.

Peer-to-peer network over wifi in iOS

I've been at this for a few days now, and can't seem to find a solution. I want to create a peer to peer network over wifi on iOS. All open source code seems to be supporting running a server or being a client, but there's no code built to support being both - a peer. Is anybody aware of a way I can do this?
iOS 7 adds the Multipeer Connectivity Framework for exactly this purpose.
Have you thought of using Apple's GameKit framework? I've used it in the past for some simple communication between devices. It's really simple and can get you out of the gate quickly. This looks like a good tutorial.
I think Open Peer is the right solution. It provides real direct peer-to-peer connection between devices without the need of a centralised server. Check out this introductory video.
You cannot create a wi-fi network programmatically in iOS using current APIs. GameKit offers some APIs to do so over bluetooth however.
If you wish to implement a custom solution using CocoaHTTPServer, be aware that you will still not be able to create a direct wi-fi connection, you will simply be able to connect devices on the same (pre-existing) wi-fi network.
Ad-hoc peer to peer Wi-Fi (such as 802.11s) in iOS is still a few years off. Maybe iOSX ;)
iOS supports the Multipeer Connectivity framework which enables iOS devices to talk to each other over Bluetooth, infrastructure (with a router) WiFi, or P2P.
It does not, however, provide a way to explicitly use P2P. There is a layer of abstraction away from how any of a device's peers (other iOS devices) are connected, and it does not currently allow for non-iOS devices to be connected.

Resources