iOS APP之间跳转

a跳转至b

1.配置b

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    NSLog(@"Calling Application Bundle ID: %@", sourceApplication);
    NSLog(@"URL scheme:%@", [url scheme]);
    NSLog(@"URL query: %@", [url query]);
    return YES;
}

2.配置a  (LSApplicationQueriesSchemes)

        //NSString *customURL = @"iOSDevApp://";
        NSString *customURL = @"iOSDevApp://?token=123abct&registered=1";
    
        if ([[UIApplication sharedApplication]
             canOpenURL:[NSURL URLWithString:customURL]])
        {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
        }
        else
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"URL error"
                                                            message:[NSString stringWithFormat:
                                                                     @"No custom URL defined for %@", customURL]
                                                           delegate:self cancelButtonTitle:@"Ok"
                                                  otherButtonTitles:nil]; 
            [alert show]; 
        } 

 参考网址:http://www.cocoachina.com/industry/20140522/8514.html

posted @ 2016-06-22 15:29  潜意识  阅读(204)  评论(0编辑  收藏  举报