Question

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>
Was it helpful?

Solution

How are you handling what happens when your application responds to the URL Scheme. You should be use this delegate method in your App Delegate:

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

     return YES;
}

Check the contents of didFinishLaunchingWithOptions. The code in this method should not be commented out. Also it looks like you have a conditional in the didFinishLaunchingWithOptions method. This is most likely while the app is hanging on startup.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top