Skip to content

Conversation

xzilja
Copy link
Contributor

@xzilja xzilja commented Dec 23, 2018

fix #22716

Changelog:

[iOS][Fixed] - Fix universal links in iOS 12 / Xcode 10

Test Plan:

Tested this on a real device running iOS 12, in theory it should work on older versions as well as previous implementation assumed * type for restorationHandler params, however if someone could test this on iOS 11 and lower, it would be much appreciated.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Dec 23, 2018
@xzilja xzilja changed the title [ios][Linking] [ios][Linking] Fix universal links not woking in iOS 12 / XCode 10 Dec 23, 2018
@hramos hramos removed the 🔶APIs label Jan 24, 2019
@hramos hramos changed the title [ios][Linking] Fix universal links not woking in iOS 12 / XCode 10 Fix universal links not woking in iOS 12 / XCode 10 Feb 25, 2019
@hramos hramos changed the title Fix universal links not woking in iOS 12 / XCode 10 Fix universal links not woking in iOS 12 / Xcode 10 Feb 25, 2019
@radex
Copy link
Contributor

radex commented Mar 1, 2019

@hramos Can we merge this? I was about to submit a nearly identical patch, because the app will Crash if you try to call this from Swift (as the type annotations don't match and a dumb cast will fail)

@hramos
Copy link
Contributor

hramos commented Mar 4, 2019

@radex any chance you can test this on iOS 11 or earlier? At a glance it seems like the incomplete test plan might have been the reason this was not merged back when it was submitted.

@xzilja
Copy link
Contributor Author

xzilja commented Mar 4, 2019

@hramos @radex

Following snippet is from firebase dynamic links implementation

- (BOOL)application:(UIApplication *)application
continueUserActivity:(nonnull NSUserActivity *)userActivity
 restorationHandler:
#if defined(__IPHONE_12_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_12_0)
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {
#else
    (nonnull void (^)(NSArray *_Nullable))restorationHandler {
#endif  // __IPHONE_12_0

// Other Code

}

They target ios 12+ specifically to apply this change, I can update my PR to this tomorrow, it should fall back to old implementation on earlier versions of iOS. Sounds ok?

@radex
Copy link
Contributor

radex commented Mar 4, 2019

@iljadaderko Right! I'm not sure if checking for __IPHONE_12_0 is the right way to go — I'd check for other RN sources to check what's the convention for checking for version (so things like tvOS are also taken into account)... there might already be a macro for that or something. But in general, a preprocessor check makes sense.

@xzilja
Copy link
Contributor Author

xzilja commented Mar 5, 2019

@radex I just looked through few react-native-community repos, but can't seem to find any macro for iOS version check / tvOS. Do you have any repos in mind that could use them for me to reference? Perhaps I should go ahead with similar solution firebase use for time being?

@xzilja xzilja closed this Mar 5, 2019
@xzilja xzilja reopened this Mar 5, 2019
@radex
Copy link
Contributor

radex commented Mar 5, 2019

@iljadaderko I did a quick search and this seems to be the RN convention:

#if __has_include(<os/log.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */

(just the defined part, os/log has nothing to do with this)

@xzilja
Copy link
Contributor Author

xzilja commented Mar 18, 2019

@hramos @radex sorry for the delay, but I have now added those conditional checks to only apply this change on ios 12+

@radex
Copy link
Contributor

radex commented Mar 18, 2019

If it compiles, looks good to me! @iljadaderko Have you had the chance to check on iOS 11 (Xcode 9) if it still compiles correctly there, just to be sure?

@xzilja
Copy link
Contributor Author

xzilja commented Mar 18, 2019

@radex Only tested this with latest XCode and iOS I'm afraid. Tests seem to be failing, but for things unrelated to this PR?

I can try to compile on earlier iOS versions devices latter this week if no one else can do this atm.

@cpojer
Copy link
Contributor

cpojer commented Mar 18, 2019

@iljadaderko please do test on a device with an older version of iOS and report back so we have confidence before merging this PR :)

@xzilja
Copy link
Contributor Author

xzilja commented Mar 22, 2019

@cpojer @radex Hey guys, I don't have access to ios 11 device, is anyone able to test this? Back when I replied I had simulator with ios11 in the back of my head, but obviously can't test linking in simulator :/

Tests are now failing as well, but it doesn't look like this is related to linking changes.

@xzilja xzilja closed this Mar 22, 2019
@xzilja xzilja reopened this Mar 22, 2019
@cpojer cpojer changed the title Fix universal links not woking in iOS 12 / Xcode 10 Fix universal links not working in iOS 12 / Xcode 10 Mar 22, 2019
Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be fine to ship.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @iljadaderko in 56679ed.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Mar 26, 2019
@cpojer
Copy link
Contributor

cpojer commented Mar 26, 2019

Hey @iljadaderko I finally managed to land this PR. I had to add a check __has_include(<UIKitCore/UIUserActivity.h>) to make it pass some Facebook internal stuff. Would you mind double checking if universal links work with React Native from master?

grabbou pushed a commit that referenced this pull request Apr 8, 2019
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
facebook-github-bot pushed a commit that referenced this pull request Nov 29, 2021
Summary:
This sync includes the following changes:
- **[c1220ebdd](facebook/react@c1220ebdd )**: treat empty string as null ([#22807](facebook/react#22807)) //<salazarm>//
- **[09d9b1775](facebook/react@09d9b1775 )**: Update deprecated features in ESLint configuration files. ([#22767](facebook/react#22767)) //<Esteban>//
- **[bddbfb86d](facebook/react@bddbfb86d )**: Revert "Fix Node package.json ./ exports deprecation warning ([#22783](facebook/react#22783))" ([#22792](facebook/react#22792)) //<Sebastian Silbermann>//
- **[b831aec48](facebook/react@b831aec48 )**: chore(fast-refresh): double check wasMounted ([#22740](facebook/react#22740)) //<anc95>//
- **[8edeb787b](facebook/react@8edeb787b )**: Fix Node package.json ./ exports deprecation warning ([#22783](facebook/react#22783)) //<Rin Arakaki>//
- **[fdc1d617a](facebook/react@fdc1d617a )**: Flag for client render fallback behavior on hydration mismatch ([#22787](facebook/react#22787)) //<salazarm>//
- **[aa19d569b](facebook/react@aa19d569b )**: Add test selectors to experimental build ([#22760](facebook/react#22760)) //<Brian Vaughn>//
- **[520ffc77a](facebook/react@520ffc77a )**: Use globalThis if possible for native fetch in browser build ([#22777](facebook/react#22777)) //<Jiachi Liu>//
- **[afbc2d08f](facebook/react@afbc2d08f )**: Remove unused react-internal/invariant-args ESLint rule. ([#22778](facebook/react#22778)) //<Esteban>//
- **[ca94e2680](facebook/react@ca94e2680 )**: Remove 'packages/shared/invariant.js' ([#22779](facebook/react#22779)) //<Esteban>//
- **[83564712b](facebook/react@83564712b )**: Move SuspenseList to experimental channel ([#22765](facebook/react#22765)) //<Andrew Clark>//
- **[d4144e6e5](facebook/react@d4144e6e5 )**: fix : grammatical typo for test description ([#22764](facebook/react#22764)) //<Brijesh Prasad>//
- **[0b329511b](facebook/react@0b329511b )**: chore: fix comment typo ([#22657](facebook/react#22657)) //<Han Han>//
- **[e6f60d2ad](facebook/react@e6f60d2ad )**: fix typos ([#22715](facebook/react#22715)) //<180909>//

Changelog:
[General][Changed] - React Native sync for revisions c0c71a8...c1220eb

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32646433

fbshipit-source-id: c534ee7a17141634700c90fc2c7b34bfbe17887a
nawbc pushed a commit to NawbExplorer/react-native that referenced this pull request Dec 7, 2021
Summary:
This sync includes the following changes:
- **[c1220ebdd](facebook/react@c1220ebdd )**: treat empty string as null ([facebook#22807](facebook/react#22807)) //<salazarm>//
- **[09d9b1775](facebook/react@09d9b1775 )**: Update deprecated features in ESLint configuration files. ([facebook#22767](facebook/react#22767)) //<Esteban>//
- **[bddbfb86d](facebook/react@bddbfb86d )**: Revert "Fix Node package.json ./ exports deprecation warning ([facebook#22783](facebook/react#22783))" ([facebook#22792](facebook/react#22792)) //<Sebastian Silbermann>//
- **[b831aec48](facebook/react@b831aec48 )**: chore(fast-refresh): double check wasMounted ([facebook#22740](facebook/react#22740)) //<anc95>//
- **[8edeb787b](facebook/react@8edeb787b )**: Fix Node package.json ./ exports deprecation warning ([facebook#22783](facebook/react#22783)) //<Rin Arakaki>//
- **[fdc1d617a](facebook/react@fdc1d617a )**: Flag for client render fallback behavior on hydration mismatch ([facebook#22787](facebook/react#22787)) //<salazarm>//
- **[aa19d569b](facebook/react@aa19d569b )**: Add test selectors to experimental build ([facebook#22760](facebook/react#22760)) //<Brian Vaughn>//
- **[520ffc77a](facebook/react@520ffc77a )**: Use globalThis if possible for native fetch in browser build ([facebook#22777](facebook/react#22777)) //<Jiachi Liu>//
- **[afbc2d08f](facebook/react@afbc2d08f )**: Remove unused react-internal/invariant-args ESLint rule. ([facebook#22778](facebook/react#22778)) //<Esteban>//
- **[ca94e2680](facebook/react@ca94e2680 )**: Remove 'packages/shared/invariant.js' ([facebook#22779](facebook/react#22779)) //<Esteban>//
- **[83564712b](facebook/react@83564712b )**: Move SuspenseList to experimental channel ([facebook#22765](facebook/react#22765)) //<Andrew Clark>//
- **[d4144e6e5](facebook/react@d4144e6e5 )**: fix : grammatical typo for test description ([facebook#22764](facebook/react#22764)) //<Brijesh Prasad>//
- **[0b329511b](facebook/react@0b329511b )**: chore: fix comment typo ([facebook#22657](facebook/react#22657)) //<Han Han>//
- **[e6f60d2ad](facebook/react@e6f60d2ad )**: fix typos ([facebook#22715](facebook/react#22715)) //<180909>//

Changelog:
[General][Changed] - React Native sync for revisions c0c71a8...c1220eb

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D32646433

fbshipit-source-id: c534ee7a17141634700c90fc2c7b34bfbe17887a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Linking Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications. Tool: Xcode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ios] Linking doesn't work with ios12 due to new continue userActivity implementation
7 participants