码迷,mamicode.com
首页 > 移动开发 > 详细

iOS9 application:application openURL: sourceApplication: annotation: 方法不执行

时间:2016-06-05 12:28:09      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:

- (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: 这个方法, 所以这两个方法都得重写..

iOS9 application:application openURL: sourceApplication: annotation: 方法不执行

标签:

原文地址:http://www.cnblogs.com/Rinpe/p/5560413.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!