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

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved