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:
- 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)
- 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
- 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
Mobile Orchard has a great tutorial, describing how to restore your applications database through Custom URL handlers of a serialized SQL Lite database:
Lite To Paid iPhone Application Data Migrations With Custom URL Handlers
(paraphrased instructions from the article)
In your email message convert your database or application data to NSData base64, and include it in a URL
For example:
[NSString stringWithFormat: @”myapplication://localhost/importDatabase?%@”,encodedStringData]
Add a handleOpenURL method to your AppDelegate implementation
Example AppDelegate Implementation:
Mobile Orchard on File size limitations: