打开文件时未执行AppDelegate

时间:2014-05-06 00:05:53

标签: ios objective-c

我有registered my iPad app to open files并在我的AppDelegate -application: didFinishLaunchingWithOptions:函数中输入逻辑来打开文件。但是,当我在我的应用程序中打开一个文件时,看起来该函数没有被调用。这是正常的吗?如果是这样,我错过了什么?如果没有,我应该从哪里开始寻找问题?

这是我的AppDelegate实施:

@implementation FPAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Check whether or not we've entered the function
    NSLog(@"%@", @"In app delegate");

    // Handle opening with a file
    NSURL* fileURL = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey];
    if(fileURL != nil)
    {
        // ...snip
    }

    return YES:
}

// ...snip

当我第一次打开我的应用程序时,我的函数顶部的NSLog语句被点击,但是当我从另一个应用程序打开其中的文件时,NSLog语句没有输出任何内容到我的控制台,让我相信函数没有被输入。

这是我的应用程序info.plist打开文件的配置:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>CAF Loop</string>
        <key>CFBundleTypeIconFiles</key>
        <array>
            <string>caf_icon.png</string>
        </array>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.apple.coreaudio-format</string>
        </array>
        <key>LSHandlerRank</key>
        <string>Owner</string>
    </dict>
</array>
<key>UIFileSharingEnabled</key>
<true/>

0 个答案:

没有答案