1

I am trying to launch my app with a custom URL scheme. If the app is backgrounded, all is fine. If the app is not backgrounded, it launches, and the launch screen never disappears, eventually it gets killed by iOS for taking too long. I have extensively debugged this, and cannot figure out the problem. I have even removed everything from my application didFinishLauinchingWithOptions to make sure that nothing was stopping it there. This is my altered code, all I am asking is that it opens and gives me a blank window, but won't even do that. Just hangs on launch screen.

if ([launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]) {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    [self.window makeKeyAndVisible];

    self.window.rootViewController = [[UIViewController alloc]init];

    return YES;
}

URL Scheme in plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>fb23423444322</string>
            <string>test</string>
        </array>
    </dict>
</array>
</plist>
4

1 回答 1

1

当您的应用程序响应 URL 方案时,您如何处理发生的事情。您应该在您的 App Delegate 中使用此委托方法:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{   
     // Do what you need here

     return YES;
}

检查 didFinishLaunchingWithOptions 的内容。此方法中的代码不应被注释掉。而且看起来你在 didFinishLaunchingWithOptions 方法中有一个条件。这很可能发生在应用程序在启动时挂起时。

于 2013-08-06T21:40:52.870 回答