简体   繁体   中英

Opening attachments from Mail in iOS4 app

I got how to open attachments in your app from the Mail app here .

But how do I handle this in an iOS4 app? When my app is in the background and I open a file from Mail, -application:didFinishLaunchingWithOptions: does not fire. -applicationDidBecomeActive does, but it does not seem to have a way to retrieve the link to the file from there.

Anyone encountered this before? Any additional pointers on pitfalls I have yet to encounter will be very helpful too. Thanks in advance!

This should work:

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

    if ([url isFileURL])
    {

        NSLog(@"file at path %@", [url path ]);
                // do something with your file
                return YES;
        }
        return NO;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM