12

I'm working on an iPhone application that would allow viewing and editing of data that I want to keep in sync with a desktop application. I don't see anything in the SDK that directly addresses data synchronization, nor can I find anything that allows my to "hook" into the iTunes sync process.

I could do something kludgy like hiding the data in a photo or address book entry, but that just seems like a bad idea. I could use WebDAV or HTTP to get/put data to a server, but it makes the application more complicated.

I guess I was expecting this to be a common use-case for iPhone apps (syncing arbitrary application data between a desktop and the iPhone) and that there would be a set of APIs in the SDK that cover this. Maybe there is and I just can't find it.

asked Oct 9, 2008 at 2:13

davidavr's user avatar

5

The two popular methods are:

Sync with a desktop app directly via WiFi (using Bonjour etc. to discover the iPhone/desktop app endpoints as others have suggested here).

The other option is to sync with a shared file location - either FTP, MobileMe, WebDAV, web services on another server, etc. So the iPhone and desktop app would read/write to the shared location so the other can see the updates.

As others have said, there is no Apple provided method (using iTunes or otherwise) at this point and no indication that anything along those lines will be happening in the near future unless it's bundled with the iPhone's future support for third-party push updates. (I really doubt this will be the case, but you never know.)

answered Oct 10, 2008 at 4:05

Adam Byram's user avatar

Comments

5

answered Oct 10, 2008 at 4:32

1 Comment

Looks good. I was hoping someone would come out with something like that, instead of reinventing the wheel for each app that comes out.

4

I haven't tried this out myself, but I think Bonjour provides the ability to connect with services on other machines, you might find some answers looking into that

answered Oct 9, 2008 at 2:19

Robert Gould's user avatar

Robert Gould

70.2k63 gold badges193 silver badges275 bronze badges

Comments

3

It's a common problem, but unfortunately not addressed by the SDK.

Since the iPhone supports Bonjour service publishing and discovery, you can easily publish a service on the phone and listen for it on the desktop, connecting when they find each other. (Or you can publish the service on the desktop and connect from the phone, either way it doesn't matter.) All of the documentation on Bonjour for MacO OS X applies to iPhone OS.

Note that Bonjour just advertises a service; once you find it, you still have to use sockets to connect and transfer data.

Basically, there is no easy way to do it, but there are enough tools available that you can make the sync experience painless for the user.

answered Oct 9, 2008 at 9:45

benzado's user avatar

benzado

84.9k22 gold badges114 silver badges138 bronze badges

Comments

2

An example for Bonjour Sync: http://cocoa-nut.de/?p=27

answered Aug 16, 2009 at 16:55

Sara

Comments

2

Just to update this answer - in the time since the question was asked, Apple have added support for syncing files to iTunes (and letting the user get to them through iTunes' Apps tab).

To do this, you have to set the UIFileSharingEnabled key to YES in your application's Info.plist file. You can then use standard file IO APIs to save files to your app's Documents directory.

There's more information here: http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW6

This includes the behaviour you should implement (i.e. making sure you also support reading documents in that are added into your Documents directory - although I've seen lots of apps that don't do this).

answered Aug 30, 2011 at 0:00

John's user avatar

John

5,5428 gold badges41 silver badges39 bronze badges

1 Comment

Yep, and there's also iCloud support coming in iOS 5. If your apps use core data at all, it's going to be relatively simple to implement cloud storage that can be accessed by an iPhone app, desktop app or web app.

1

I'm also working on an application that needs to share data, the only reasonable/non hack way I found to get information in and out of the iPhone is through NSURLConnection.

(personal opinion) I don't foresee Apple providing hooks to the sync process.(/personal opinion)

answered Oct 9, 2008 at 5:24

lajos's user avatar

lajos

25.7k19 gold badges67 silver badges75 bronze badges

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.