Is it possible to to communicate an iOS app communicate over the USB port to a Windows computer? - ios

I have an iOS application with a tableview which I would like to send text strings via USB to my Windows computer indicating which cell was selected by the user.Anyone have experience with this type of interface?

I've written a blog post detailing how to achieve this here.
http://thecodewash.blogspot.com/2017/05/communicating-with-your-ios-app-over.html
To answer your question (so this answer isn't just a link), yes it definitely is possible to achieve this utilizing the USB Multiplexing Daemon (usbmuxd) program that is usually installed as part of iTunes. This program can create a socket connection to your iOS device through the USB cable, and allow you to communicate via that socket connection like you would any other socket. The link goes into much more detail.
Hope this helps!

(In short) Yes, you can communicate with ios application via normal socket communication by using ITunes which acts like proxy. In this model your ios app acts like server listening for connection. Windows app must connect to iTunes on port 27015 and estabilish connection to specific port (used by ios app) on connected via usb device. This is done by using a special MUX protocol described here

Related

iOS - How to send message from hotspot (iPhone) to connected client (IoT device)

I've searched google and only found the MultipeerConnectivity framework in iOS but I don't know how I could make it work for my specific case.
The flow of what I want to do is like this:
Enable personal hotspot in iOS
Connect to hotspot from a raspberry pie
Once client is connected, send a message string from the iOS app.
Assuming that the raspberry pie connection is already sorted out (We're using a static SSID and Password for the hotspot)
The questions that come up are:
Which framework should I use (assuming there is one already)?
do I need to explicitly advertise the iOS device from the app?
How do I get notified when the raspberry connects to the phone?
How do I send a message to the connected client?
Although I never developed anything for Pi, I developed net service browsing for iOS devices, so can give an answer.
When you connect to iPhone hotspot, it's a usual WiFi connection, so here you can use Bonjour protocol (mDNS) to discover devices one another.
Run Avahi mDNS service on Pi, and discover it on iPhone.
Here is how to run Avahi on Pi.
Here is how to discover mDNS net service on iPhone.
After net service is discovered with NSNetServiceBrowser, you'll have IP address and port of your Pi available on your iPhone, so you can connect to it.
If you are trying to setup a IoT system, it may be useful to look into various cloud offerings to facilitate messaging between devices. Personally I have used AWS IoT core services in the past, and it is relatively easy to setup messaging between devices.
I am not sure what your exact use case is for this setup, but using a cloud based service to setup messaging between devices will remove the requirement to connect directly between devices via hotspot (the pi still needs some internet connection), and could make it easier to enable multiple devices and app clients in the system.

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).

Connect iPhone to local server for testing on XCode? -- without using WiFi

So I have an ejabberd (XMPP) server setup on my MacBook. Connects fine with Simulator, only intermittently on the device. The two times it hasn't connected were at cafes that had sign-on gateways for their Wi-Fi. I know nothing when it comes to networks, but I'm guessing this is a Firewall thing?
I'm supposing I can't get around the firewall without an elaborate workaround.
I've found that turning off Wi-Fi on both devices and turning on tethering so that both devices are communicating via data works. However, I'd rather not do this as my data plan is limited and I'd like to be freely internet-connected while I work.
Is there a way to setup XCode to have the phone use the USB connection to access the server on the MacBook? Or maybe some other way I'm not imagining?
Bluetooth doesn't work.
I don't believe that the problem is with some kind of firewall on the network…
Try using the local IP address instead of the hostname, It will change from network to network. To get it, you can open the network utility
In this case it would be [xmppStream setHostName:#"172.16.1.2"];

How do I open port 7 for iOS TCP/IP communications testing?

I'm trying to write an app that uses TCP/IP to communicate to and from an iPhone. To test the basic calls, I was trying to open port 7 (which supposedly is set up to echo any input back to the receiver), write to it, and read the results.
My code works after a fashion. I can, for example, open a site using "www.xxx.com" for a host name and port 80, write an http address, and get back a response.
The problem is that I get an error, "The operation couldn't be completed. Connection refused" error when trying to access port 7, and presumably any other port that isn't opened by Apple for a specific purpose. I've opened port 7 on the AirPort WiFi router using the AirPort Utility app, and tried opening and writing to port 7 both on my Mac and on the iPad using their respective IP addresses from iOS, and always get the same error.
What needs to be done to open ports so I can use TCP/IP to communicate using iOS, either to other iOS devices or with a desktop computer? Or is using port 7 as a test simply not the way to go?
This question was answered by some kind folks on the Apple Developer forms. To summarize:
There is no supported way to use an echo service on iOS. The only way to test TCP/IP turns out to be to create a connection to an actual server. The development Mac can be used for that using, for example, netcat.

Connect an Ipad to a controller

I need to run an application in my ipad which has to talk wirelessly to a controller. The controller communicates on serial as well as RS485 port. It doesn't have a wifi adapter.
What are the options for me to do this ?
One thought is, I have to buy a wifi to RS485 adapter which I will attach to my controller and then my ipad can connect to the controller through the wifi adapter. Is this feasible? My doubts are because, I am not sure whether Ipad has the capability to open a raw socket connection to the remote wifi adapter (on the controller).
If not, then what are the other options which are available for me ?
If you are comfortable with fairly straight forward electronics and programming, this is how I would do it.
I would forget about having them talk directly and instead use the internet, you can get cheap controller called an Electric Imp that you can create code for using their online portal to connect your device to the internet, the device itself connects up using wifi and its own secure VPN.
Once you have it connected up you can create you own webpage or app to talk to their cloud, this has the added advantage you can now control your device wherever you can get an internet connection and your device can continue to interact to the internet even when your ipad is off.
http://electricimp.com

Resources