Can I set up the iPhone app to launch when a user opens an email attachment?

Is there a way to launch my application when a user clicks on an email attachment so that I can access the attached file?

What I want to do is implement backup / restore application data:

  • A user sends an email with an attached data file with a special extension (I will use the new iPhone 3.0 message composer class)
  • If the user loses their data, they will be able to go to their mailbox and open the last email sent with the application data file.
  • Then they just click on the attached file, which causes my application to start and recover from this file

Is it technically possible to complete the last step?

thanks

+3
source share
3 answers

Mobile Orchard has a great tutorial that describes how to restore an application database using custom URL handlers for a serialized SQL Lite database: Lite for paid iPhone application data migrations with custom URL handlers

(paraphrased instructions from the article)

AppDelegate:

#import "GTMBase64.h"

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
    if([@"/importDatabase" isEqual:[url path]]) {
        NSString *query = [url query];
        NSString *importUrlData = [GTMBase64 webSafeDecodeString:query];

        // NOTE: In practice you will want to prompt the user to confirm before you overwrite their files!
        [importUrlData writeToFile:@"/path/to/FullApplication/Documents/file" atomically:YES];
        return YES;
    }
    return NO;
}

Orchard:

100k , URL- . , . , SQLite- , XML , .

+5

(Listomni) URL , . SQLite, . , , GMail Outlook, URL- 2048 .

, iPhone OS 3.0, , , , , , . Apple

0

Source: https://habr.com/ru/post/1713492/


All Articles