App之间的跳转-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

App之间的跳转

App之间的跳转

成都创新互联专注于新宾企业网站建设,响应式网站建设,商城网站制作。新宾网站建设公司,为新宾等地区提供建站服务。全流程定制设计,专业设计,全程项目跟踪,成都创新互联专业和态度为您提供的服务

1,添加URL Types项

a,打开项目中.xcodeproj下的info目录,增加一项URL Typs
 App之间的跳转

2,配置URL Scheme

a,将URL identifie选项为com.KeYi.lsf

b,将URL Scheme选项的内容修改为lsf


 - (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation
{
//抓取url
    if (!url) {
        return NO;
    }else {
        if ([[url host] isEqualToString:@"expert"]) {
            
            NSArray *codeArr = [[url query] componentsSeparatedByString:@"="];
            if (codeArr.count >0) {
                if (self.window.rootViewController) {
                    BaseTabBarController *tabBarController = (BaseTabBarController*)self.window.rootViewController;
                    BaseNavigationController * bnc = (BaseNavigationController*)tabBarController.selectedViewController;
                    HomeDetailController * hdc = [[HomeDetailController alloc]init];
                    hdc.expertInfoDic = @{@"expertUserId":codeArr[1]};
                    [bnc pushViewController:hdc animated:YES];
                }else {
                    
                }
            }
            return YES;
        }else if ([[url host] isEqualToString:@"topic"]) {
            NSArray *codeArray = [[url query] componentsSeparatedByString:@"&"];
            NSArray *codeArr = [codeArray[0] componentsSeparatedByString:@"="];
            NSArray *otherArr  = [codeArray[1] componentsSeparatedByString:@"="];
            if (codeArr.count > 0) {
                if (self.window.rootViewController) {
                    BaseTabBarController *tabBarController = (BaseTabBarController*)self.window.rootViewController;
                    BaseNavigationController * bnc = (BaseNavigationController*)tabBarController.selectedViewController;
                    ExpertDetailController * edc = [[ExpertDetailController alloc]init];
                    edc.topicInfo = @{@"topicId":codeArr[1],@"expertUserId":otherArr[1]};
                    [bnc pushViewController:edc animated:YES];
                }else {
                    
                }

            }
            return YES;
        }
            
    }
...
}


当前名称:App之间的跳转
网址分享:http://kswsj.cn/article/jdjspp.html

其他资讯