tags:

views:

411

answers:

4

Is there any way to run my app when the user taps on an e-mail attachment, so I can access the attached file?

What I want to do is implement some kind of backup / restore for app data:

  1. The user sends an e-mail with an attached data file that has a special extension (I will be using the new iPhone 3.0 message composer class)
  2. If the user loses his data, they will be able to go to their e-mail box and open the last e-mail they sent with the app data file
  3. Then they simply tap on the attached file, which causes my app to run and restore from that file

Is it technically possible to perform the last step?

Thanks

A: 

I don't think this exists in the SDK API yet. There may be hidden methods that allow this though, if you don't mind making your application available only to jailbroken users.

Wahnfrieden
A: 

I don't think you can have your application run for a particular file type, but you can register it as listening for a particular URL scheme, see for instance:

http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

so if your application data isn't too huge, you might be able to use a custom base64-encoded URL like

mycustomappbackup://[lots of data here]

David Maymudes
Hey David, thx for your help. Do you know is there any limit on custom URL length?
Aler
+4  A: 
Dougnukem
Mobile Orchard blog looks great. I just subscribed to it
Aler
A: 

My App (Listomni) uses the URL approach to backup the database and mail it, and also for migration from the lighter apps into the full version. We additionally compress the serialized SQLite database, which saves a lot of room. However, it's less than optimal for backup purposes with intensive amounts of data because if users forward the mail via GMail or Outlook, then both clients have a tendency to truncate the URL to 2048 bytes.

I was also hoping since we can now send attachments with iPhone OS 3.0, that we could also register filetypes, to later retrieve them, but sadly doesn't look like this is supported yet. shakes fist at Apple