Communicate with an External Accessory over Wi-Fi in an iOS App - ios

I am building an app which will communicate with an external accessory capable of establishing a wi-fi bridge.
I am not able to defer the situation that how do I establish connection with this external accessory and then the device should be shown connected in my app.
After connection, there are certain actions I need to perform on the device. So a two way communication is also a requirement. How do I initiate a connection and then communicate over it.
Is any Apple framework available for it. As I am not able to find anything.
If possible, please provide a sample code on how to achieve this feat.
Thanks in advance.

Related

How to transfer data from one app to another app from different iOS devices which have same WiFi network in swift?

I want to transfer data from one app to another app from different iOS devices which have same WiFi network
I used MultipeerConnectivity framework and it works great
You need to implement Client/Server model for this in which if you want to transfer file from 1 device you need to make it server and make it discoverable on the go thourgh LAN/WIFI scanner libraries and then implement FTP/SMB protocols to transfer files. On the other side make the second device Client which will then discover devices on the same network and allow them to connect through the implemented protocols.
What task do you want to solve? Maybe MultipeerConnectivity framework will be appropriate in your case. It doesn't need event same wifi network

How can I implement Core Bluetooth Functionality for multiple devices?

Okay, I have been successful so far in my core bluetooth journeys. I just need to clarify a few things regarding what the best practises are for using bluetooth in my app. My queries are:
First of all, I want to know how best I can optimize my code. Do i have to discover and connect for every page that I want to use bluetooth on? How is it possible for me to connect to a peripheral and use that connection on the next page in the app without having to call the didConnectPeripheral: function everywhere?
Secondly, I have been meaning to connect two peripheral devices onto my app. I know that this is possible, but how does it work? Is the connection timeshared or are they happening simultaneously? Do I have to disconnect one to be able to access the other? What is the optimal approach to connect two devices to the app without each other's connection interfering with each other?
Any directions would be much appreciated! Cheers
No, you don't need to connect to device for each 'screen' you have. Create one CBCentralManager, connect to given device once and connection will exist(unless you explicitly tell it to disconnect) for the whole lifecycle of this CBCentralManager.
You can connect to several CBPeripheral devices simultaneously by using single CBCentralManager but CBPeripheral cannot connect to anyone, it just accepts connections from CBCentral's.
Recently I've released my own wrapper around CoreBluetooth technology called YRBluetooth. It simplifies a lot of CoreBluetooth things by providing another abstraction level. There you can find simple demo chat application that was built using YRBluetooth.

iPad app syncing with custom API over wired connection

Is there any way to provide 2 way sync capabilities over a wired connection? The connection would be between an iPad app and a custom Web API. The app currently works over a wireless connection. However, one of our potential clients does not allow for wireless connections due to security restrictions.
Any help would be appreciated. Also, please let me know if more information needs to be provided.

Communicate an iOS device with a non iOS device via WIFI

I am working on a project in which I should connect an iPhone to an accessory via WIFI.
Some blogs spoke about ExternalAccessory.framework but this one is used for establishing connection via Bluetooth.
What library should I use to achieve this ? Could any one please point me to the right direction ? Thanks.
(Assuming that you don't know the ip address of the device you want to connect to)
From an iOS standpoint you want to use NSNetService to discover devices on the network which you can connect to.
This requires that your other device can use mdnsresponder to publish its details onto the network such that it can be found and connected to.
If you do know the ip address (or, once you do know it) then you can use NSURLConnection / NSStream to connect to the device (depending on what capabilities it offers).

Not able to view active servers through wifi and connect with it all the time by using Bonjour and NSNetServiceBrowserDelegate?

i am working on an App that uses wifi network to pass data from one ipad to another ipads .
i have already referred the following sample code about:
http://mobileorchard.com/tutorial-networking-and-bonjour-on-ip
The above sample code connects Devices using wifi and can exchange messages using Cfnetworking and Bonjour.
My problem is that i am not able to see Active Servers all the time .While Some times it Shows me Active servers and i can easily connect with and Exchange Messages but when i relaunch or open the app after some time it doesn't show me active servers so i am unable to connect and exchange messages. The same problem occurs in the sample code available from above link having tutorial on to Send data over wifi to another Devices.
I am Stucked up over here where i am unable to connect with active Devices all the time because not able to access those servers.
In chatty sample code same problem occurs where you can see active chat room's and connect with but some times you will not be able to see those active chat rooms availabe even if there are active servers who have already started new chat room where all Devices are connected to same wifi network.
Any help would be highly Appreciable , Thanks in advance.
Any chance the wi-fi interface on the device is going to sleep from disuse? Or that the user roamed to a different Wi-Fi access point with the same name that isn't bridged via Bonjour?
Have you considered using Multipeer Connectivity instead of using Bonjour directly? IIRC, that API would let you communicate even if the devices are not on the same Wi-Fi network, which is probably what you want anyway.

Resources