Exchange data between iOS app and Mac app through USB cable - iphone

I'm looking for a way to exchange data between my own iOS app and my own OS X application through a cable.
I know there have to be frameworks to connect to the device from inside a Mac application, apps like iExplore can import and export files from the device.
It doesn't matter in which way the data is exchanged as long as it's through a cable. It may use the filesystem, or if I can get the device on the same network as the Mac through a connection or even use 3rd party hardware.
It doesn't matter if it uses private APIs or if the device needs a jailbreak, it is for internal use only.
Thanks in advance.
IMPORTANT: the solution can't feature anything wireless, no wifi, no bluetooth, no cellular tethering, the data exchange should work even with the device in airplane mode. This is the main requirement.
And it has to be relatively fast. I want to exchange small packages less than 1 kB once every few seconds. The delay between send and receive should be as little as possible, 1 second is the longest acceptable delay.

Take a look at https://bitbucket.org/tristero/ipodaccessframework which can get/put files into an applications private document directory, provided you know its application bundle id.

Related

Create an iPad app that can send/receive data via the USB cable?

I want to create an iPad app that connects to another machine, laptop or otherwise, via USB and communicates to some other application I develop running there.
I know that this is easy to achieve via Bluetooth or WiFi but this particular set of solutions must be done via a USB cable.
Is it possible to do so without access to the Apple MFi program? (I am about 5 weeks in and the response is not looking good).
iOS App --> USB Cable --> Mac OSX --> Desktop App (without MFi access)
Thanks
To use USB communication Apple does not provide any API within IOS SDK. The only option right now is MFI. I don't think Apple will allow this in near future.
To use serial communication, you need MFI as you may have discovered. However, there is a poor man's way of achieving this. I have done so during development.
Enable "Internet sharing" on your device and connect to it. Use "ifconfig" on your Mac to find out the interface to use. You do not need to use this as the default connection, but it needs to be active. If I remember correctly, only one end can initiate connections (it was a while so I am sorry that I don't remember the details).
EDIT: I would also like to point out that I did this on an iPhone, not an iPad.
Not over USB but over RS232 (serial port)
Look here: http://www.redpark.com/c2db9.html
But:
The cable uses the old 30 pin connector, but according to them it's compatible with the Lightning adapter
The application won't be accepted on the AppStore, it's for internal use only.
There is a (small) book that explains how to use this cable to connect an iPhone directly to an Arduino, it's been published in late 2011. "iOS Sensor Apps with Arduino Wiring the iPhone and iPad into the Internet of Things" http://shop.oreilly.com/product/0636920021179.do

Establish communication link between a device and iOS

I'm developing an iPhone/iPad app that requires it communicate with another device. I'm actually more interested in receiving input from another device that the iPhone is connected to through USB. The solution needs to work with any iOS device and cannot require it to be jailbroken.
I've heard of apps that communicate with a piece of hardware that can be plugged to the iOS' serial connection, which is similar to what I'm going to develop except that the other device I'll be connecting to is a standalone music keyboard.
best regards,
fbr
If you are developing accessories that need to connect to iOS devices and want to use your own communication mechanism then you need to join the Apple MFi program.
Several options:
Forget MFi unless you have 1000s of $ backing up your product development. Apple won't even talk to you. I've tried.
Take a look at the Serial Cable from Redpark (http://redpark.com/c2db9.html)
I've got one of those and it's ideal for apps that you can deliver on your own, but you might also be able to get them into the App Store.
Another option is to use Wifi with a Wifi-to-Serial adapter on the other end. I've used the RN-174 and RN-134 from Roving Networks successfully.
However, these solutions only get you Serial connections, but can be quite fast, especially with the RN modules. There are also Serial-to-USB converters you can use on the device's end, but that would require the device to work as a USB host, usually. If you have a USB device that wants to act as a client, these common adapters won't do the trick.
So, unless you can actually afford the MFi program, and if you really need USB connectivity, you'll have to let someone create a small box containing a USB host adapter with a Wifi chip. I don't know of a ready-made solution for this yet, although I've seen quite a few area where people would like to have such a unit.

any examples of a server/client iphone app where both the server and clients are iOS devices?

I would like to create a server/client application where one iphone is running a server, and all other devices on the same wifi network can connect to the server device and send and receive information. Are there any examples of running a server on a device and letting other devices on the network search for it?
I looked into using GameKit, but the 16 person max limit is unfortunate. cocoaasyncsocket seems like a good option, but how do I set up one device as the server, and search for it on other devices?
The WiTap sample code may be what you're looking for (or at least a good place to start):
http://developer.apple.com/library/ios/#samplecode/WiTap/Introduction/Intro.html

use 3g for internet when connected to adhoc wifi (using private API's)

First and foremost,
I am looking for a resource to use Private API's.
this is an enterprise application and will never go to the app store
I need to take as much configuration out of the users hands as possible.
That being said, I have a device that an ipad will be connected to and communicate with via an adhoc wifi network supplied by the device. the ipad connects to this device and sends raw data to it via socket connections. I also need to connect to the internet for data syncing.
80% of the time, the ipad will be connected to this adhoc wifi device. Management software on the ipad does not allow the user to adjust wifi settings so I am trying to make sure I am connected to my device without limiting my server syncing. I know I can determine the connection using apples Reachability class, this is not what i am looking for. I need to use BOTH 3g AND wifi.
Is there a way to enforce this in code? Or is there a resource for the private API's that I can look at to find a way?
This will be in iOS 5 and the most preferable method would be to just route my http requests via some private api method to use 3G and let the socket requests use wifi to the adhoc device.
code samples would be awesome, links / class names to research would be very much appreciated.
and once again this is not going into the app store, it is an enterprise app
the resolution i found was to assign an ip in the privately assigned ip range the ipad uses (169.254.x.x) to the adhoc device then let the ipad determine an ip. Then see if i can open a socket connection to the device (to determine if its available) and then issue a print.
Going this route, i am still able to use 3g data as well as communicate with the device via wifi.

iPhone interaction between PC app and iPhone app using USB

I know since the 3.0 SDK we can use accessories, so my question is simple, what is the process to make an iPhone app and PC (or Mac) app interact, using the USB ?
I don't ask you any code, but just the paths and the keys for making that work.
Have I to access the iPhone disk through SSH and work with files ?
Or can I send data from the iPhone app and intercept (get) it on the PC app (and send data from PC to iPhone) ?
Thanks, and if this question is stupid, just tell me, I didn't find on Dev Center (I don't really know what I have to looking for...) !
Edit : I read some news from Microids, they will synchronize PC and iPhone games (i.g here), and somewhere (I can't find it again) they say connecting the iPhone on the USB, so I think this is possible
USB access on the phone is only supported via the External Accessory Framework. You cannot hook the iPhone up to arbitrary USB devices, the devices actually have to support the EA protocol. You can get more details about it via the Made for iPhone program.
Other than that there is no USB access available on to applications.
You want the External Accessory Framework. Having said that, I'm not sure that Apple's intention was for you to communicate with an application on a PC/Mac. It's really for talking to accessories such as iPod docks, remote controls, etc. Apple may not allow an application that talks to a PC in this manner in the App Store.
You might be interested in ssh_relay (earlier called iphone_tunnel).
There is a /System/Library/Lockdown/Services.plist on your iPhone and you can start any such services via AMDeviceStartService and then communicate with it.
The ssh_relay demonstrates how to do that by having a simple port forwarder as a service on the iPhone site and the client application on your PC, so you can forward any local iPhone port to your PC. This is not exactly what you wants here (it is handy in the case you have already another service running on the iPhone which communicates via simple TCP and you want to access that; for example SSH) but based on this example, it should be straight-forward to have any communication between the service (in Services.plist) and your PC.