在iOS4应用中从Mail打开附件

问题描述 投票:1回答:1

我从邮件应用程序here中了解了如何在您的应用程序中打开附件。

但是我如何在iOS4应用中处理此问题?当我的应用程序在后台运行并且从Mail中打开文件时,-application:didFinishLaunchingWithOptions:不会触发。 -applicationDidBecomeActive可以,但是似乎没有办法从那里检索到文件的链接。

有人遇到过这个吗?我还没有遇到的关于陷阱的任何其他指针也将非常有帮助。预先感谢!

iphone objective-c cocoa-touch ipad
1个回答
1
投票

这应该起作用:

- (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;
}
© www.soinside.com 2019 - 2024. All rights reserved.