Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Add support for react-native 0.60.5 autolinking #39

Closed
loredanacirstea opened this issue Sep 18, 2019 · 15 comments · Fixed by #40
Closed

Add support for react-native 0.60.5 autolinking #39

loredanacirstea opened this issue Sep 18, 2019 · 15 comments · Fixed by #40
Assignees
Labels
bug Something isn't working

Comments

@loredanacirstea
Copy link

After doing:

react-native init my-project
cd my-project
npm install react-native-uport-signer --save
cd ios && pod install

(1) trying the new react-native autolinking
I get:

Detected React Native module pod for RNUportSigner
Analyzing dependencies
[!] The `RNUportSigner` pod failed to validate due to 1 error:
    - ERROR | attributes: Missing required attribute `homepage`.
    - WARN  | source: The version should be included in the Git tag.
    - WARN  | description: The description is equal to the summary.

I changed to s.homepage = "https://github.com/uport-project/react-native-uport-signer.git" in RNUportSigner.podspec

I got then got Unable to find a specification for UPTEThereumSignerdepended upon byRNUportSigner`` -> I changed UPTEThereumSigner to `UPTEthereumSigner` in `RNUportSigner.podspec`

-> Pod installation complete!, but building the project with Xcode has an error: framework not found EthCore

Using use_frameworks! or use_modular_headers! gets rid of the EthCore error, but have other issues. (probably related: facebook/react-native#25349 (comment))

(2) Explicit linking, as in your Readme:

react-native link react-native-uport-signer
cd ios && pod install

I get:

Analyzing dependencies
[!] No podspec found for `RNUportSigner` in `../node_modules/react-native-uport-signer`

I then replaced pod 'RNUportSigner', :path => '../node_modules/react-native-uport-signer' from Podfile with pod 'RNUportSigner', :path => '../node_modules/react-native-uport-signer/ios/RNUportSigner.podspec'

-> Pod installation complete!, but building the project with Xcode has the same error: framework not found EthCore

@jasheal jasheal added the bug Something isn't working label Sep 18, 2019
@jasheal jasheal assigned jasheal and aldigjo and unassigned jasheal Sep 18, 2019
@mirceanis
Copy link
Contributor

Thank you for reporting this.
We haven't checked support for 0.60 yet so there is no answer I can give at this time.
We would appreciate a PR if you stumble upon a workaround in the meantime.

@loredanacirstea
Copy link
Author

@mirceanis, what is the latest react-native version that should work with this package?
I also tried 0.59.9 and had some issues with RNUportHDSigner, RNUportSigner being undefined when imported. I would have to test again to be sure.

@mirceanis
Copy link
Contributor

I believe it was 0.59.8
As far as I know this sample app does not manifest these issues: https://github.com/uport-project/react-native-signer-demo

@aldigjo
Copy link
Contributor

aldigjo commented Sep 18, 2019

@loredanacirstea running pod install isn't part of the set up process, unless you are running this for your own pods? Have you also manually added the Pods.xcodeproj to your Libraries in your project?

@loredanacirstea
Copy link
Author

@aldigjo, I have tried without pod install on a fresh app, but when I do:

import {getSignerForHDPath, RNUportHDSigner, RNUportSigner} from 'react-native-uport-signer';

RNUportHDSigner and RNUportSigner are undefined. getSignerForHDPath is defined. So, I thought the native modules linking was the issue.
I tried react-native-signer-demo, which worked! But I tried reproducing it (versions, etc.) and I got the same issue as above. So, I suspect a cache issue on my side even though I reset the watchman, metro-bundler caches.

I haven't tried manual linking yet (I had previous issues with mixing cocoapods with xcode linking). But I will try that.
Thank you.

@aldigjo
Copy link
Contributor

aldigjo commented Sep 18, 2019

@loredanacirstea Let me know if you continue having issues even with the manual linking process!

@loredanacirstea
Copy link
Author

loredanacirstea commented Sep 18, 2019

@aldigjo, you already helped: reproducing on another react-native 0.59.8 app worked after adding:

  • Pods.xcodeproj, RNUportSigner.xcodeproj to Libraries
  • libRNUportSigner.a to Link binary with libraries

For react-native 0.60.5 I did:

  • install with yarn + react-native link react-native-uport-signer, then add this to react-native.config.js:
module.exports = {
  dependencies: {
    'react-native-uport-signer': {
      platforms: {
        android: null,
        ios: null,
      },
    },
  },
};
  • rebuild pods (gets rid of the podspec errors from my first message) (update: no, it did not - react-native just skiped the uport-signer pod, so disregard the following)
cd ios
pod deintegrate
pod repo update
pod install
pod update
  • Pods.xcodeproj, RNUportSigner.xcodeproj to Libraries
  • libRNUportSigner.a to Link binary with libraries

But I still have build errors ('React/RCTBridgeModule.h' file not found in RNUportSigner), because the xcode project structure is changed and I haven't found a good way to link it yet.

@aldigjo
Copy link
Contributor

aldigjo commented Sep 18, 2019

@loredanacirstea just to be clear, are you referring to the Xcode project structure of react-native?

@loredanacirstea
Copy link
Author

Yes. I am talking about .xcworkspace created by react-native.

@aldigjo
Copy link
Contributor

aldigjo commented Sep 20, 2019

@loredanacirstea using these steps on a fresh project works for me, it looks like the react-native init command is somehow messing up the scheme

react-native init testProj
cd testProj
npm i react-native-uport-signer --save
open ios/testProj.xcworkspace/ 
  1. Manully add RNUportSigner.xcodeproj and Pods.xcodeproj to Libraries from node-modules/react-native-uport-signer

  2. Go to testProject -> Build Phases -> Link Binary with libraries and add libRNUportsigner.a

  3. In Xcode go to product -> Scheme -> edit scheme -> Build and If it says React is missing just delete that and re-add it

@loredanacirstea
Copy link
Author

@aldigjo, I had one more step to do (otherwise it did not work): adding testProj/node_modules/react-native/React/React.xcodeproj to Libraries before re-adding React to Scheme -> Build -> Targets.
But it works now, thank you (I'm a noob with react-native, so it was very helpful).

Ideally, it should have worked without manual linking, but this is on react-native and their 0.60+ problem with use_frameworks! - as far as I can see.

@aldigjo
Copy link
Contributor

aldigjo commented Oct 7, 2019

@loredanacirstea Please try version 1.6.0, auto linking should be functional in that version

@loredanacirstea
Copy link
Author

@aldigjo, I get the same error as #42: Framework not found EthCore.

@jasheal
Copy link

jasheal commented Oct 10, 2019

@loredanacirstea there may be some caching of the old version of it's native dependency UPTEthereumSigner on your machine. Check the version that's being pulled in when you run pod install. If it's v1.1.4 then run pod update UPTEthereumSigner to pull in latest. Clean and build.

Perhaps we should make the version explicit in the .podspec if caching is a problem.

Same for #42

@loredanacirstea
Copy link
Author

@jasonhealy, yes, it works after pod update (#42 (comment)).
Explicit version / lower bound would be good.

Also, thank you all for the version update!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants