How do I write a desktop application that syncs with the iPhone? - iphone

For example, how would I write a program like senuti? Are there any libraries I can use for this? It would be ideal if I could do this in Python or .Net, but I'm open to other things as well.

There are three things you can do:
Add some code to your iPhone application which acts as some kind of server (http, SMB, etc). Then your mac/windows full client application can connect to this server over wifi. This is safe and reliable, but unfortunately the app will have to be running on the iPhone at the time of sync.
Sync to the "cloud". EG: Have your iPhone app save some data to a web server on the internet (you could use amazon EC2, windows Azure, or even just a PHP script running on a cheap hosting account), and then have your windows/mac client also connect to this web server to retrieve the data. This is the most user-friendly, but it requires you to pay for the hosting of the web server, and will be unsuitable for large amounts of data
Violate the EULA and try to reverse engineer the way iTunes communicates with the iPhone.
This is how senuti works, but I wouldn't recommend it, as they're constantly having to play catchup with apple changing the format underneath them, and they are probably exposed to some kind of legal action, if apple ever bothered to sue them.

i believe Version 3.0 will resolve this as it allows you to program apps to the USB interface. check out some of the documentation for that in the External Accessory framework.
it would still require the app to be open, so essentially would mean two syncs (or more if you have multiple apps)

There is no legal / official way of doing this. Creating a program that would sync with an iPhone would violate the EULA you agree to when using the iPhone and iTunes.
Not only is it illegal, but it's also impossible to do this reliably. Apple could break the method at any time without any notice, and it would pretty much be a cat-and-mouse game.
I only know of one application that something of the kind, and it is the iToner application which synchronizes ringtones.

Related

Is CocuchDB/TouchDB designed to serve offline/online setup for ios apps?

I am in little bit confusion because of my less understanding about CouchDB. Let me explain in simple words. I am developing an iphone app for which my client may ask for android version. I am using CouchDB as data storage for this application.
We designed a backend from where admin can setup/update information. ALL updated information should be replicated to all iphone device. When I say replicate from server to device I does not mean replication from one iphone device to another. Means source of updated always will be server.
My client also wants that most of the functionality if possible should work offline. To make some of the functionality offline client asked me to use CouchDB and TouchDB(on iphone) which will be synch up automatically.
According to me CouchDB is not designed to serve this purpose but designed for replication which is required for distributed computing where source of data is not one server but multiple.
Using CouchDB/TouchDB I am facing lot of issues. One of the big issue is my logic and UI implementation are together built on my xcode. If tomorrow I want to develop Android application then again I have to implement same logic in android syntax. Change in logic needs update both versions. More frustrating if client wants to develop windows and BB version tomorrow.
To avoid this I can suggest my client we should use 3-tier architecture where we will built one middle ware and we will keep our logic there. Only work we need to develop at app level is fetch data from middle ware via WebService and present UI.
But before suggesting to my client I want to confirm my idea from expertise. I might be wrong as I do not well knowledge about CouchDB and maybe CouchDb is only designed for offline/online setup.
Please waiting to here from expertise.
I'm working on something similar right now, so I can share what I've found.
We're using BigCouch (a fork of CouchDB managed by Cloudant that provides a cluster of Couch machines) to store our data and then using TouchDB for iOS to replicate data down to mobile devices.
We've been able to get TouchDB working with BigCouch, but it hasn't been without a few bumps in the road. TouchDB takes advantage of the existing replication functionality built into CouchDB and handles it well.
From my experience TouchDB also works very well in offline mode. The replication will pick up where it left off when the device went offline. You can also configure Touch to do pushes, pulls - or both, so that's nice.
The real issue is when you want to move to Android. The TouchDB Java port is in a sorry state right now. It exists, but it's not ready for production. In fact I saw on Twitter just this week that they're trying to hire someone to take over the project.
Even if the Java port of TouchDB was ready for production, you're right, you'd have to re-write the code for Android. Then again this would be the case no matter what technology you use.

How to create a Mac/PC server app that interacts with iPhone/iPad App?

Can someone please point me in the right direction to create a Mac/PC server app that runs in the background and connects to an iPad app over the local WiFi network?
No matter how I phrase a search on Google it just brings up various apps like Remote Mouse and whatnot and no tutorials or even a hint of where to start.
I just need to send simple commands from iPad to computer over local wifi. A point in the right direction and I can likely fill in the blanks.
Thank you.
Thomas
EDIT: I am using web languages for the iPad version that I will build as a native app using open source tools.
OK, then. It actually depends on what you really need. I made the assumption you need real-time and perhaps binary data transfer.
Your best bet is to write your server application using standard C or C++ so it compiles on both as simply as possible.
If you want to avoid all the burden of writing a protocol for service discovery or asking users to enter the ip address of your server you will use a mDNS implementation for your server and your iPhone app.
If I were you I would try bonjour: http://www.apple.com/support/bonjour/
on iPhone You could start here: http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/NSNetServiceProgGuide/Articles/PublishingServices.html
Once you have your sockets you will have to implement a networking protocol between your server application and your iPhone app.
You will have to be careful about byte ordering and little subtle problems with latency, disconnections and other problems inherent to networking and WiFi.
In windows you will want to register your application as a service and in Mac OS X/UNIX you'll probably want to deamonize it.
Good luck!

What is the best way to implement a Server-Client connection between an iPad and multiple iPhones?

Based on a college-project I'm trying to realize a relatively simple game (Poker) where an iPad acts as Server and multiple iPod-Touchs connect to it as Clients.
Gamekit seems to drop out, since those old ipod-touch-devices don't have bluetooth-support.
Are there already some Frameworks out there simplifying the process, or do I have to fall back on TCP-Streaming-Sockets and implement it myself?
For your task I suggest you have a look at ThoMoNetworking or AsyncSocket.
ThoMoNet is a very simple setup that is specifically developed for fast and easy prototyping and easy to set up. Is will automatically create a bi-partite graph between all instances of you application it finds in the local network. So If you keep your iPad as the server and the iPhones as clients this will come down to less than 10 lines of code to set up.
AsyncSocket is a commonly used framework with ports to PC as well but requires more code to write. On the other hand it will allow you to do more fancy things, should you need them.
Distributed objects are not yet available on iPhone OS, so excluding GameKit you may try using Bonjour networking. Otherwise, you may try using web services with some of the available libraries. If Bonjour and web services are not a choice/possibility, then you have to revert to old plain sockets.

iPhone to Mac Sync Over Wi-Fi

I am writing an iPhone application and would like to sync data over Wi-Fi between the iPhone and a complementary Mac application which I will also be writing (much like what is accomplished with Things and 1Password). To provide specific context, I need to be able to upload a CSV file to the iPhone application, have the ability to edit the data on the iPhone, and then re-download that file to the computer.
I am familiar enough with the mechanics of parsing and editing the CSV file once on the iPhone, but I am unsure how to approach the Wi-Fi sync between the iPhone and Mac. Obviously this is possible, since other applications have achieved the same thing, but do I need to setup some kind of server on the iPhone (which the Mac can talk to) or maybe a server in the Mac-side application (which the iPhone can talk to).
Any suggestions would be greatly appreciated. Thanks in advance.
In my apps, I use CocoaHTTPServer to get local info into and off of the phone. You run the server and out-of-the-box, it indexes all the files in the documents directory.
To do what you want, you will need to edit the code to return some other kind of data format (xml probably is the easiest) the call this from inside your app to get that data. CocoaHTTPServer easily take POST right out of the box too, so you can post an xml response as well.
After thinking about it, CocoaHTTPServer is best run on the computer side behind the scenes. the iphone can then send info to the computer where handling the code should be easier and you have more options.
On top of this you will want to look into Bonjour, it will allow the computer and the iphone to discover each other without too much difficulty. (ie by advertising their info on the network)

Secure iPhone-Desktop Connection

Background
There are a lot of App Store released iPhone apps that require an IP based server on the desktop so that the iPhone can connect to the desktop as a client. For example, there are many programs that emulate a keyboard, touchpad, or Apple remote on the iPhone so that a desktop computer can be controlled over wifi. However, many of these applications get around writing their own server by requiring the user to install some VNC server variant.
Question
What is the best way to implement a secure (encrypted) IP server on a desktop (Mac and Windows platforms) that allows for simple two way message passing between itself and an iPhone client on a wifi network?
Sample Use Case
An event on the desktop causes the desktop to push a small image or text to the iPhone. An event on the iPhone causes a short text message to be pushed to the desktop. Any single event can happen at any time (doesn't appear synchronized to the user).
1st Follow-Up Question
Would this type of project be best handled using something like XML or JSON over HTTP? Or is there a better protocol, like BEEP or Bonjour(XMPP)?
What is the best way to implement a secure (encrypted) IP server on a desktop (Mac and Windows platforms) that allows for simple two way message passing between itself and an iPhone client on a wifi network?
Not sure if there is a "best" way, but much code is already available to do xyz-over-HTTPS (TLS/SSL). In that case, the "xyz" can be any web-based message exchange protocol, such as XML, JSON, etc. via REST or SOAP, etc.
If you want to be able to push events to a non-jailbroken iPhone you can't do it other than via Apple's Push Server which causes a notification to the client program if it is running or otherwise displays an alert of some kind to the user.
Typical architecture has those notifications handled by the client program as an indication it should go and get some data from the server - Apple insist we do not regard the notifications as trusted delivery.
I suggest a read of this article on using Bonjour and local networking, whilst it's iPhone to iPhone it should apply to desktop OS/X also.