开发者

Opening attachments from Mail in iOS4 app

开发者 https://www.devze.com 2023-01-30 17:56 出处:网络
I got how to open attachments in y开发者_如何学Pythonour 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, -applicatio

I got how to open attachments in y开发者_如何学Pythonour 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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消