简体   繁体   中英

Opening app with custom url scheme in ios app

I have two url scheme, say, openView1:// and openView2:// . Now, when i click to openView1://, i want to pen view1. When i click to openView2://, i want to pen view2.

I did like following at appDelegate.m

 #import "Welcome_ResetPassword.h"
 @implementation AppDelegate

 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:     (NSString *)sourceApplication annotation:(id)annotation { 
 isopenView1= FALSE; //    isopenView1 is global varaible define in appDelegate.h 
 isopenView2= FALSE; // isopenView1 is global varaible define in appDelegate.h 
 if ([[url scheme] isEqualToString:@"openView1"]) {
    isopenView1= TRUE;
    return isopenView1; 
}
else{
    isopenView2= TRUE;
    return isopenView2; 
}

}

now,

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
 if ( isopenView1) {
    //show view1 as app start 
 }else{
   //show view2 as app start 
 }
}

This is not working. How can I achieve it?

我相信自iOS 5.0起,网址格式不区分大小写(小写)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM