Handle URL scheme react-native and Swift2019 Community Moderator ElectionEncode URL in JavaScript?Get current URL with jQuery?How do I modify the URL without reloading the page?Get the current URL with JavaScript?Open a URL in a new tab (and not a new window) using JavaScript#ifdef replacement in the Swift language#pragma mark in Swift?What is the difference between React Native and React?React Native Android Native View life cycle eventsneed assistance witth implementing facebook sdk into AppDelegate.m file

HP P840 HDD RAID 5 many strange drive failures

In what cases must I use 了 and in what cases not?

Asserting that Atheism and Theism are both faith based positions

Is it insecure to send a password in a `curl` command?

How is the partial sum of a geometric sequence calculated?

Pronounciation of the combination "st" in spanish accents

두음법칙 - When did North and South diverge in pronunciation of initial ㄹ?

Does the attack bonus from a Masterwork weapon stack with the attack bonus from Masterwork ammunition?

Help rendering a complicated sum/product formula

I got the following comment from a reputed math journal. What does it mean?

Existence of a celestial body big enough for early civilization to be thought of as a second moon

Maths symbols and unicode-math input inside siunitx commands

Recruiter wants very extensive technical details about all of my previous work

What does Jesus mean regarding "Raca," and "you fool?" - is he contrasting them?

How to get the n-th line after a grepped one?

Print last inputted byte

Brake pads destroying wheels

What is the relationship between relativity and the Doppler effect?

Is there a term for accumulated dirt on the outside of your hands and feet?

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Why are there no stars visible in cislunar space?

Is it possible to stack the damage done by the Absorb Elements spell?

Calculate the frequency of characters in a string

Probably overheated black color SMD pads



Handle URL scheme react-native and Swift



2019 Community Moderator ElectionEncode URL in JavaScript?Get current URL with jQuery?How do I modify the URL without reloading the page?Get the current URL with JavaScript?Open a URL in a new tab (and not a new window) using JavaScript#ifdef replacement in the Swift language#pragma mark in Swift?What is the difference between React Native and React?React Native Android Native View life cycle eventsneed assistance witth implementing facebook sdk into AppDelegate.m file










2















I would like to handle custom URL scheme in my react-native application. Thus I first added an eventListener in my JS code inside my root component like that :



componentDidMount() 
Linking.addEventListener('url', this.handleOpenURL);


componentWillUnmount()
Linking.removeEventListener('url', this.handleOpenURL);


handleOpenURL = event =>
console.log('event', event);
;


In my Xcode application, I added a custom URL scheme "com.myScheme".



My problem has appeared when I tried to add the function in my AppDelegate.swift to handle deep linking.



Here's my function :



func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool 
print(url)
return true



It seems that return true is not enough to trigger my listener inside my application ...



I know there's an Objective-C method in the react-native documentation :



#import <React/RCTLinkingManager.h>

- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

return [RCTLinkingManager application:application openURL:url options:options];



But I would like to deal only with Swift for my project in order to improve my skills in this language. The problem is I can't find any example of this function implemented using Swift.



That's why I'm asking some help to implement this method and then trigger my event inside my RN application.



Thank you for your understanding :)










share|improve this question




























    2















    I would like to handle custom URL scheme in my react-native application. Thus I first added an eventListener in my JS code inside my root component like that :



    componentDidMount() 
    Linking.addEventListener('url', this.handleOpenURL);


    componentWillUnmount()
    Linking.removeEventListener('url', this.handleOpenURL);


    handleOpenURL = event =>
    console.log('event', event);
    ;


    In my Xcode application, I added a custom URL scheme "com.myScheme".



    My problem has appeared when I tried to add the function in my AppDelegate.swift to handle deep linking.



    Here's my function :



    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool 
    print(url)
    return true



    It seems that return true is not enough to trigger my listener inside my application ...



    I know there's an Objective-C method in the react-native documentation :



    #import <React/RCTLinkingManager.h>

    - (BOOL)application:(UIApplication *)application
    openURL:(NSURL *)url
    options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

    return [RCTLinkingManager application:application openURL:url options:options];



    But I would like to deal only with Swift for my project in order to improve my skills in this language. The problem is I can't find any example of this function implemented using Swift.



    That's why I'm asking some help to implement this method and then trigger my event inside my RN application.



    Thank you for your understanding :)










    share|improve this question


























      2












      2








      2








      I would like to handle custom URL scheme in my react-native application. Thus I first added an eventListener in my JS code inside my root component like that :



      componentDidMount() 
      Linking.addEventListener('url', this.handleOpenURL);


      componentWillUnmount()
      Linking.removeEventListener('url', this.handleOpenURL);


      handleOpenURL = event =>
      console.log('event', event);
      ;


      In my Xcode application, I added a custom URL scheme "com.myScheme".



      My problem has appeared when I tried to add the function in my AppDelegate.swift to handle deep linking.



      Here's my function :



      func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool 
      print(url)
      return true



      It seems that return true is not enough to trigger my listener inside my application ...



      I know there's an Objective-C method in the react-native documentation :



      #import <React/RCTLinkingManager.h>

      - (BOOL)application:(UIApplication *)application
      openURL:(NSURL *)url
      options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

      return [RCTLinkingManager application:application openURL:url options:options];



      But I would like to deal only with Swift for my project in order to improve my skills in this language. The problem is I can't find any example of this function implemented using Swift.



      That's why I'm asking some help to implement this method and then trigger my event inside my RN application.



      Thank you for your understanding :)










      share|improve this question
















      I would like to handle custom URL scheme in my react-native application. Thus I first added an eventListener in my JS code inside my root component like that :



      componentDidMount() 
      Linking.addEventListener('url', this.handleOpenURL);


      componentWillUnmount()
      Linking.removeEventListener('url', this.handleOpenURL);


      handleOpenURL = event =>
      console.log('event', event);
      ;


      In my Xcode application, I added a custom URL scheme "com.myScheme".



      My problem has appeared when I tried to add the function in my AppDelegate.swift to handle deep linking.



      Here's my function :



      func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool 
      print(url)
      return true



      It seems that return true is not enough to trigger my listener inside my application ...



      I know there's an Objective-C method in the react-native documentation :



      #import <React/RCTLinkingManager.h>

      - (BOOL)application:(UIApplication *)application
      openURL:(NSURL *)url
      options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

      return [RCTLinkingManager application:application openURL:url options:options];



      But I would like to deal only with Swift for my project in order to improve my skills in this language. The problem is I can't find any example of this function implemented using Swift.



      That's why I'm asking some help to implement this method and then trigger my event inside my RN application.



      Thank you for your understanding :)







      javascript ios swift xcode react-native






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 6 at 22:19









      Andrew

      6,33441427




      6,33441427










      asked Mar 6 at 22:10









      HurobakiHurobaki

      181220




      181220






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Regarding your AppDelegate method, the swift version should be :



          public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 
          return RCTLinkingManager.application(app, open: url, options: options)






          share|improve this answer























          • Thank you this is exaclty what I was looking for ! It works like a charm ;)

            – Hurobaki
            Mar 7 at 13:48










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032981%2fhandle-url-scheme-react-native-and-swift%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Regarding your AppDelegate method, the swift version should be :



          public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 
          return RCTLinkingManager.application(app, open: url, options: options)






          share|improve this answer























          • Thank you this is exaclty what I was looking for ! It works like a charm ;)

            – Hurobaki
            Mar 7 at 13:48















          1














          Regarding your AppDelegate method, the swift version should be :



          public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 
          return RCTLinkingManager.application(app, open: url, options: options)






          share|improve this answer























          • Thank you this is exaclty what I was looking for ! It works like a charm ;)

            – Hurobaki
            Mar 7 at 13:48













          1












          1








          1







          Regarding your AppDelegate method, the swift version should be :



          public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 
          return RCTLinkingManager.application(app, open: url, options: options)






          share|improve this answer













          Regarding your AppDelegate method, the swift version should be :



          public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool 
          return RCTLinkingManager.application(app, open: url, options: options)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 13:02









          Ro22e0Ro22e0

          29919




          29919












          • Thank you this is exaclty what I was looking for ! It works like a charm ;)

            – Hurobaki
            Mar 7 at 13:48

















          • Thank you this is exaclty what I was looking for ! It works like a charm ;)

            – Hurobaki
            Mar 7 at 13:48
















          Thank you this is exaclty what I was looking for ! It works like a charm ;)

          – Hurobaki
          Mar 7 at 13:48





          Thank you this is exaclty what I was looking for ! It works like a charm ;)

          – Hurobaki
          Mar 7 at 13:48



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032981%2fhandle-url-scheme-react-native-and-swift%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко