Skip to content

Commit

Permalink
Fix universal links not working in iOS 12 / Xcode 10 (#22764)
Browse files Browse the repository at this point in the history
Summary:
fix #22716

Changelog:
----------
[iOS][Fixed] - Fix universal links in iOS 12 / Xcode 10
Pull Request resolved: #22764

Differential Revision: D14576559

Pulled By: cpojer

fbshipit-source-id: 4ef727e1d9aa7646359b63468285fec1f8f1651b
  • Loading branch information
iljadaderko authored and facebook-github-bot committed Mar 26, 2019
1 parent 2a336f2 commit 56679ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Libraries/LinkingIOS/RCTLinkingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

+ (BOOL)application:(nonnull UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
restorationHandler:(nonnull void (^)(NSArray *__nullable))restorationHandler;
restorationHandler:
#if __has_include(<UIKitCore/UIUserActivity.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler;
#else
(nonnull void (^)(NSArray *_Nullable))restorationHandler;
#endif

@end
8 changes: 6 additions & 2 deletions Libraries/LinkingIOS/RCTLinkingManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ + (BOOL)application:(UIApplication *)application

+ (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray * __nullable))restorationHandler
{
restorationHandler:
#if __has_include(<UIKitCore/UIUserActivity.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 12000) /* __IPHONE_12_0 */
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {
#else
(nonnull void (^)(NSArray *_Nullable))restorationHandler {
#endif
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSDictionary *payload = @{@"url": userActivity.webpageURL.absoluteString};
[[NSNotificationCenter defaultCenter] postNotificationName:kOpenURLNotification
Expand Down

0 comments on commit 56679ed

Please sign in to comment.