Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 tasks done
xzilja opened this issue Dec 19, 2018 · 1 comment
Closed
3 tasks done
Labels
API: Linking Bug Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@xzilja
Copy link
Contributor

xzilja commented Dec 19, 2018

Environment

  React Native Environment Info:
    System:
      OS: macOS 10.14.1
      CPU: x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
      Memory: 293.77 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.14.2 - /usr/local/bin/node
      Yarn: 1.12.3 - /usr/local/bin/yarn
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      @types/react: 16.7.17 => 16.7.17 
      @types/react-native: 0.57.18 => 0.57.18 
      react: 16.7.0-alpha.2 => 16.7.0-alpha.2 
      react-native: 0.57.8 => 0.57.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1

Description

Per linking documentation iOS implementation for handling universal links right now is

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{

 // Debug log something here
 return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

With iOS 12 and XCode 10 this no longer seems to work (I think ios 12 forces new implementation?), there is new way to handle universal links that should look like this

- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity 
restorationHandler: (nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {

  // Debug log something here
  return [RCTLinkingManager application:application
                  continueUserActivity:userActivity
                    restorationHandler:restorationHandler];
}

As you can see they added UIUserActivityRestoring as a new type for restorationHandler. When running on iOS 12 and using old approach I don't see my // Debug log something here message at all. When I use new approach I see the message, but app crashes at RCTLinkingManager with following error

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x100a9cde0)

There is also an xcode issue saying

Cannot convert value of type '([UIUserActivityRestoring]?) -> Void' to expected argument type '(([Any]?) -> Void)?'

Related apple docs entry: https://developer.apple.com/documentation/uikit/uiapplicationdelegate/1623072-application?language=objc

@xzilja xzilja changed the title [ios] Linking doesn't work in ios12 due to new continue userActivity implementation [ios] Linking doesn't work with ios12 due to new continue userActivity implementation Dec 19, 2018
@xzilja
Copy link
Contributor Author

xzilja commented Dec 19, 2018

I assume this has something to do with following lines, but I'm not sure if switching it to new implementation won't break everything:

https://github.com/facebook/react-native/blob/master/Libraries/LinkingIOS/RCTLinkingManager.h#L25
https://github.com/facebook/react-native/blob/master/Libraries/LinkingIOS/RCTLinkingManager.m#L70

@hramos hramos removed the 🔶APIs label Jan 24, 2019
@hramos hramos removed the Bug Report label Feb 6, 2019
grabbou pushed a commit that referenced this issue 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 facebook locked as resolved and limited conversation to collaborators Mar 26, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API: Linking Bug Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants