From 56679ed359834c2177c8837d744cc7bf2ceb6b0a Mon Sep 17 00:00:00 2001 From: Ilja Daderko Date: Tue, 26 Mar 2019 12:01:26 -0700 Subject: [PATCH] Fix universal links not working in iOS 12 / Xcode 10 (#22764) Summary: fix #22716 Changelog: ---------- [iOS][Fixed] - Fix universal links in iOS 12 / Xcode 10 Pull Request resolved: https://github.com/facebook/react-native/pull/22764 Differential Revision: D14576559 Pulled By: cpojer fbshipit-source-id: 4ef727e1d9aa7646359b63468285fec1f8f1651b --- Libraries/LinkingIOS/RCTLinkingManager.h | 7 ++++++- Libraries/LinkingIOS/RCTLinkingManager.m | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Libraries/LinkingIOS/RCTLinkingManager.h b/Libraries/LinkingIOS/RCTLinkingManager.h index de38c85de62216..b0d8d0053504f2 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.h +++ b/Libraries/LinkingIOS/RCTLinkingManager.h @@ -22,6 +22,11 @@ + (BOOL)application:(nonnull UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity - restorationHandler:(nonnull void (^)(NSArray *__nullable))restorationHandler; + restorationHandler: + #if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */ + (nonnull void (^)(NSArray> *_Nullable))restorationHandler; + #else + (nonnull void (^)(NSArray *_Nullable))restorationHandler; + #endif @end diff --git a/Libraries/LinkingIOS/RCTLinkingManager.m b/Libraries/LinkingIOS/RCTLinkingManager.m index f86266a7e4327f..61523b1c841835 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.m +++ b/Libraries/LinkingIOS/RCTLinkingManager.m @@ -68,8 +68,12 @@ + (BOOL)application:(UIApplication *)application + (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity - restorationHandler:(void (^)(NSArray * __nullable))restorationHandler -{ + restorationHandler: + #if __has_include() && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */ + (nonnull void (^)(NSArray> *_Nullable))restorationHandler { + #else + (nonnull void (^)(NSArray *_Nullable))restorationHandler { + #endif if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { NSDictionary *payload = @{@"url": userActivity.webpageURL.absoluteString}; [[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification