zoukankan      html  css  js  c++  java
  • iOS9 application:application openURL: sourceApplication: annotation: 方法不执行

    - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url NS_DEPRECATED_IOS(2_0, 9_0, "Please use application:openURL:options:") __TVOS_PROHIBITED;
    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(nullable NSString *)sourceApplication annotation:(id)annotation NS_DEPRECATED_IOS(4_2, 9_0, "Please use application:openURL:options:") __TVOS_PROHIBITED;
    - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString*, id> *)options NS_AVAILABLE_IOS(9_0); // no equiv. notification. return NO if the application can't open for some reason
    

    从上面的API能看出, iOS9之后从其他app回到自己app的时候回调的方法已经变成最后一个了..

    所以需要在AppDelegate中重写该方法, 例如:

    - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
    {
        // 监听linePay付款完后wap界面跳转
        [self handleOpenFromLinePayWithUrl:url];
        return YES;
    }
    
    - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<NSString *,id> *)options
    {
        // 监听linePay付款完后wap界面跳转
        [self handleOpenFromLinePayWithUrl:url];
        return YES;
    }
    

     注意: iOS9以下还是会回调application:application openURL: sourceApplication: annotation: 这个方法, 所以这两个方法都得重写..

  • 相关阅读:
    面试题目——《CC150》链表
    TCP/IP——链路层
    TCP/IP——基本知识
    面试题目——《CC150》数组与字符串
    Java递归算法——三角数字(消除递归)
    Java排序算法——拓扑排序
    Java排序算法——希尔排序
    Python学习笔记——条件和循环
    Python学习笔记——集合类型
    英文写作——冠词的使用(Use 0f Articles)
  • 原文地址:https://www.cnblogs.com/Rinpe/p/5560413.html
Copyright © 2011-2022 走看看