标签:
从一个APPClient跳转到另一个APPServer,这里的APPClient APPServer知识代表两个不同的APP,不拥有BunldId的功能。我刚开始就理解错了。
实现从APPClient跳转到另一个APPServer:
1.首先在APPServer的info.plist中添加一行属性。
url 的构成为:pupuwang://com.pupuwang.XWCustomer
其中 URL Schemes 最重要 ,为url的前缀,URL identifier 为url的://后面的字符串
2. 在APPServer的UIApplication的代理中,实现
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ if ([[url absoluteString] isContainSubString:@"com.pupuwang.XWCustomer"]) { return YES; } return NO; }
3.在APPClient中
NSURL *url = [NSURL URLWithString:@"pupuwang://com.pupuwang.XWCustomer"];// url 模式:APPServer的URL Schemes://URL identifier BOOL hasInstagram = [[UIApplication sharedApplication] canOpenURL:url]; if (hasInstagram) { //跳转 [[UIApplication sharedApplication] openURL:url]; }else{ //到appStore下载 //NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/cn/app/id%@",XW_B_APPID]; NSString *url = [NSString stringWithFormat:@"https://itunes.apple.com/"]; UIApplication * application = [UIApplication sharedApplication]; //到store下载商户版 [application openURL:[NSURL URLWithString:url]]; }
并且实现UIApplication的代理
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url{ return YES; }
即可实现从APPClient跳转到APPServer
标签:
原文地址:http://www.cnblogs.com/yyzanll/p/4819053.html