美文网首页
Ios 打开第三方应用传值

Ios 打开第三方应用传值

作者: 透支未来 | 来源:发表于2017-06-07 19:08 被阅读30次

#pragma mark 设置系统回调
// 支持所有iOS系统
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{

   NSLog(@"%@", url);
    
    if ([[url scheme] isEqualToString:@"myurltest"])
    {
        //处理链接
        NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle:@"新消息" message:text delegate:self cancelButtonTitle:@"知道了" otherButtonTitles: nil];
        [myAlert show];
        
        return YES;
    }
    
    return NO;
}

//仅支持iOS9以上系统,iOS8及以下系统不会回调
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
{
NSLog(@"%@", url);
    
    if ([[url scheme] isEqualToString:@"myurltest"])
    {
        //处理链接
        NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle:@"新消息" message:text delegate:self cancelButtonTitle:@"知道了" otherButtonTitles: nil];
        [myAlert show];
        
        return YES;
    }
    
    return NO;
}
//支持目前所有iOS系统
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
   NSLog(@"%@", url);
    
    if ([[url scheme] isEqualToString:@"myurltest"])
    {
        //处理链接
        NSString *text = [[url host] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle:@"新消息" message:text delegate:self cancelButtonTitle:@"知道了" otherButtonTitles: nil];
        [myAlert show];
        
        return YES;
    }
    
    return NO;
}

相关文章

  • Ios 打开第三方应用传值

  • swif-闭包传值

    闭包传值 打开xclode,创建ios->single view application ->next ->pr...

  • 地图导航

    URI跳转方式地图导航的代码实践iOS调用第三方地图路线导航IOS实现应用内打开第三方地图app进行导航 高德 i...

  • iOS的五种传值

    前言 iOS常见的五种传值分别为属性传值,通知传值,代理传值,block传值,单例传值 属性传值 用于正向传值,简...

  • ios常用的三种传值方式

    iOS中有多种方案可以实现页面之间的传值,例如:属性传值、代理传值、block传值、单例传值...。常用的三种传值...

  • Block传值

    iOS传值一共有四种:属性传值,代理传值,通知传值以及Block传值; 今天我们来说一下Block传值: 概念:带...

  • iOS 传值方法(属性传值、代理传值、Block、通知、单例)

    iOS 传值方法(属性传值、代理传值、Block、通知、单例)简单的介绍一下几个传值方式 1、属性传值 在传值的时...

  • iOS 常用传值方式

    总结 iOS 日常开发中的几种常用传值方式:正向传值代理传值block传值通知传值单例 文章代码:https://...

  • iOS页面间传值详解(二)

    在iOS页面间传值详解(一)中,介绍了iOS界面间的正向传值以及逆向传值的两种方法,其实逆向传值还可以使用bloc...

  • iOS9及之后第三方应用URL Schemes白名单收集

    从IOS9之后ios系统策略对打开第三方应用做了一定限制,应用本身需要在“info.plist”中将要使用的URL...

网友评论

      本文标题:Ios 打开第三方应用传值

      本文链接:https://www.haomeiwen.com/subject/pgsafxtx.html