Giter Site home page Giter Site logo

Comments (23)

 avatar commented on August 16, 2024 3

Hi @naartjie @unicornRainbows,
I cleaned up the header search paths and framework search paths in the newest version, now it should work out of the box with an ejected app. Also SDK has been updated to use latest versions on both ios and android.
Kind regards,
Jure

from blinkid-react-native.

 avatar commented on August 16, 2024 1

Sure, but those search paths won't work with blinkid-react-native, because the xcode project is in node-modules/blinkid-react-native/src/ios so it would need a bit more tweaking I think.
As for the 2.14 version of BlinkID, yeah I tested blinkid-react-native and it seems to work, you can try using it, we'll update the README. Next week we'll have a new release and we'll try to take care of these issues with it.

from blinkid-react-native.

JEGardner avatar JEGardner commented on August 16, 2024

OK as an update, I am still working on this. It turns out it only got as far as the build because I removed BlinkID from the Linked Frameworks and Libraries - hence it was undefined. I did this because I cannot get it to build with BlinkID included. I get the error 'React/RCTBridgeModule.h' file not found in BlinkIDReactNative.h.

I have tried many many things to get round this issue. https://stackoverflow.com/a/41488258 looked promising but didn't work. I've tried adding various things to Header Search Paths. Nothing has got it to build. Any advice on what to try next? There's a bit of time pressure so if I'm not able to get this working soon I will need to use another library.

from blinkid-react-native.

lirfu avatar lirfu commented on August 16, 2024

Hi @JEGardner,
have you tried manually adding Pods/Headers/Public to the Header Search Paths as recommended here: https://docs.expo.io/versions/v17.0.0/guides/expokit.html#ios

from blinkid-react-native.

JEGardner avatar JEGardner commented on August 16, 2024

Hi @lirfu, thanks for the reply. I think they've been added automatically. Here's a screenshot of my Header Search Paths. I'm not very experienced with iOS development, does anything look wrong?
image

from blinkid-react-native.

 avatar commented on August 16, 2024

Hi @JEGardner,

what version of react-native are you using?
This could happen because there are incompatibilities in react-native versions or if the project structure changes due to ejecting and the BlinkIDReactNative project doesn't find react-native headers that are used in the wrapper. You can find BlinkIDReactNative project in the project navigator under Libraries.

Kind regards,
Jure

from blinkid-react-native.

JEGardner avatar JEGardner commented on August 16, 2024

Hi Jure, thanks for your reply. I'm using Expo's archived React Native version sdk-24.0.0, which is React Native version 0.51. I can see BlinkIDReactNative.xcodeproj is under Libraries, so I think that's correct. Any ideas what I could try to make the BlinkIDReactNative find the react-native headers?

from blinkid-react-native.

 avatar commented on August 16, 2024

Hi @JEGardner

you can try adding these two paths to the header search path in BlinkIDReactNative targets build phase:

  • $(SRCROOT)/../../../../react-native/React
  • $(SRCROOT)/../../../../react-native/Libraries

Here I'm assuming that node-modules folder is not different than the one in our demo app.
These should be automatically linked when you run react-native link. These paths should point to the react-native/React and react-native/Libraries directory inside node-modules.

Have you tried running our demo app and does it work for you, you can build it with initReactNativeDemoApp.sh. Note that the version of react-native is 0.48.3 but you can change it to 0.51.0.

Kind regards,
Jure

from blinkid-react-native.

unicornRainbows avatar unicornRainbows commented on August 16, 2024

Hello there, I am experiencing the same issue.. The only thing that i can think of that broke it upgrading to 0.51 RN.. Was working before..

@JEGardner did you manage to get it working again.. Im getting this error.. { [TypeError: undefined is not an object (evaluating '_blinkidReactNative.BlinkID.scan')] line: 94474, column: 74, sourceURL: 'http://192.168.101.248.xip.io:8081/index.bundle?platform=ios&dev=true&minify=false' }

from blinkid-react-native.

 avatar commented on August 16, 2024

Hi @unicornRainbows,

did you also eject your app or you initialised it like we initialise our demo app using react-native init?

Kind regards,
Jure

from blinkid-react-native.

unicornRainbows avatar unicornRainbows commented on August 16, 2024

Hello @cularj

I did and it was working previously. :) When i log the keys from the import i get the correct values, but logging BlinkID give me undefined.

Then i do a react-native link blinkid-react-native and get the 'React/RCTBridgeModule.h' not found, Tried to change it to #import "RCTBridgeModule.h" but still get the file not found error..

So the only way I get the app to build is by unlinking blinkid-react-native but then I am back at square one regarding BlinkID returning undefined.

from blinkid-react-native.

 avatar commented on August 16, 2024

Hi @unicornRainbows, @JEGardner
I think I found a solution, it's not really pretty but it works. It seems that ejecting with ExpoKit makes the project structure different and react-native files are added through pods.
Now as I said in previous posts, BlinkIDReactNative project can't find react headers, so you will need to add them.
Go to the BlinkIDReactNative target and search for header search paths under build-settings.
Add the following or overwrite the current header search path with:

$(inherited)
"${PODS_ROOT}/Headers/Public" 
"${PODS_ROOT}/Headers/Public/yoga"
"${PODS_ROOT}/Headers/Public/React"

Note that this target doesn't have PODS_ROOT defined so you will need to add that too. Just click on the plus, left of the search bar, and choose add user-defined setting.
Set the name to PODS_ROOT and the value to ${SRCROOT}/../../../../../ios/Pods.
This should take care of the issue. Note that after defining PODS_ROOT you can also overwrite the framework search path with :

$(inherited)
"${PODS_ROOT}/PPBlinkID"
$(PROJECT_DIR)

This makes it a bit cleaner.
Kind regards,
Jure

from blinkid-react-native.

naartjie avatar naartjie commented on August 16, 2024

Thanks very much @cularj. I am working together with @unicornRainbows on this issue and that helped!

I just wanted to say that our app is not ejected from expo, but it is using React via Pods:

pod 'React', path: '../node_modules/react-native', subspecs: [
 ...
]

So I think your advice applies to all projects which pull React as a pods dependency, not just ejected apps. Should we update the README?

from blinkid-react-native.

naartjie avatar naartjie commented on August 16, 2024

Also, while we're on the README, which version of PPBlinkID is it safe to use with v1.4.0 of this project?

While we were having these issues we tried upgrading to latest 2.15.0 but it wasn't compatible, so we bumped down to 2.14.0 and that seems to be working, well compiling and the screen opens at least, but I haven't done any thorough testing.

Is it safe to update the README with pod 'PPBlinkID', '~> 2.14.0'?

from blinkid-react-native.

naartjie avatar naartjie commented on August 16, 2024

@cularj I realised that for this to work in our project, I needed to make changes to blinkid-react-native and check in our own fork.

In this state it won't work for any non-pods projects, but for reference here is the commit.

Do you know how other projects do it, where they support React as both a Pod dependency, or as a direct project library?

from blinkid-react-native.

naartjie avatar naartjie commented on August 16, 2024

This is the way lottie-react-native does it:

	HEADER_SEARCH_PATHS = (
		"$(SRCROOT)/../../node_modules/react-native/React/**",
		"$(SRCROOT)/../../node_modules/react-native/ReactCommon/**",
		"$(SRCROOT)/../../../react-native/React/**",
		"$(SRCROOT)/../../../react-native/ReactCommon/**",

Looks like they just reference both ways the react headers could be reached. Are you happy if I take a stab at a PR @cularj?

from blinkid-react-native.

yasinugrl avatar yasinugrl commented on August 16, 2024

Hi @cularj
When I integrate to 2.15.0 and click scan button I get the Cannot read property 'scan' of undefined error.

Can you help me how can I solve this issue. What is the reason of that?

from blinkid-react-native.

naartjie avatar naartjie commented on August 16, 2024

@cularj Awesome. I've taken 1.4.2 for a spin and it works perfectly out of the box. Thanks very much!

should work out of the box with an ejected app

Also, just to clarify again, we're not using an ejected setup (we were never using Expo), we're just using React via CocoaPods, so it might be worthwhile mentioning it in the README, although now that it's been fixed, people shouldn't be having issues regardless if React is a lib in their project or if it's being pulled in via pods, it should work seamlessly either way ;-)

Thanks again.

cc @unicornRainbows

from blinkid-react-native.

naartjie avatar naartjie commented on August 16, 2024

@JEGardner, if you can confirm the issue is gone on your side, this can be closed.

from blinkid-react-native.

L00nger avatar L00nger commented on August 16, 2024

@cularj @naartjie
Hi, after successfully implementing the module in Android, now I'm facing this same problem.

My app environment is:
created with: react-native init,
package version: 1.4.2,
PPBlinkID: 2.15,
react-native: 0.53

Headers:
captura de pantalla 2018-02-16 a las 13 46 14

Error message:
[TypeError: undefined is not an object (evaluating '_blinkidReactNative.BlinkID.scan')]

Thanks in advance!

from blinkid-react-native.

 avatar commented on August 16, 2024

Hi @LoongerBuxus

Try removing " in your headers, although I don't think this should be the problem,
Do you have PODS_ROOT defined in your build settings? Also I don't see ${PODS_ROOT}/Headers/Public/React but it should be there if you are using v1.4.2.
Is react added as a xcodeproject in your app, or is it added through cocoapods.

Since you stated that you created your project using react-native init I'm guessing React is added as an xcodeproject in that case you should add following to your header search paths:

$(SRCROOT)/../../node_modules/react-native/React
$(SRCROOT)/../../node_modules/react-native/ReactCommon

Otherwise specifying PODS_ROOT and adding ${PODS_ROOT}/Headers/Public/React should do the trick.

Kind regards,
Jure

from blinkid-react-native.

L00nger avatar L00nger commented on August 16, 2024

@cularj Thanks for your reply. React is in Libraries added as a xcodeproject.

So I removed the " and added these headers to the Pods Build Phases:

$(SRCROOT)/../../node_modules/react-native/React
$(SRCROOT)/../../node_modules/react-native/ReactCommon

But this didn't solve the problem.

from blinkid-react-native.

L00nger avatar L00nger commented on August 16, 2024

I think I found where the problem is, the entry for BlinkIDReactNative in the headers search path of the main target was corrupt. I have corrected it and it now works.

from blinkid-react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.