Skip to content
This repository has been archived by the owner on Jul 18, 2020. It is now read-only.

Cannot read property of 'init' of undefined #133

Closed
ldunphy1 opened this issue Mar 10, 2017 · 15 comments
Closed

Cannot read property of 'init' of undefined #133

ldunphy1 opened this issue Mar 10, 2017 · 15 comments

Comments

@ldunphy1
Copy link

ldunphy1 commented Mar 10, 2017

I saw that this issue existed, but also that it was closed without stating a solution.
My package.json:
{
"name": "dirtydrawz",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "15.3.2",
"react-native": "0.34.1",
"react-native-collapsible": "^0.7.0",
"react-native-custom-checkbox": "^1.5.0",
"react-native-datepicker": "^1.4.2",
"react-native-elements": "^0.6.4",
"react-native-lock": "^0.5.0",
"react-native-material-kit": "^0.3.3",
"react-native-toggle": "^1.0.3",
"react-native-vector-icons": "^3.0.0"
}
}

image

@lukewlms
Copy link

lukewlms commented Mar 13, 2017

Here's how I solved this. Note that it appears the react-native linking through the CLI is not working correctly.

You can see better error messages by first running react-native run-ios. If you have the same problem as I do, you'll see that Lock.h and OneSignal.h are not found.

  1. Change all paths in xcode > Project > Libraries > A0RNLock.xcodeproj > Build Settings > All > Search Paths > Header Search Paths to the ones specified in the Manual install section of the RN Lock instructions. (this requires removing one layer of ".." from each line)

  2. Do the same for Libraries > RCTOneSignal.xcodeproj

  3. yarn add react-native-onesignal (or do it with npm). (

4. Add this line to your podfile (per OneSignal/react-native-onesignal#59)

pod 'OneSignal' Confirmed not needed per comment by @hernan-m87

  1. Clean with xcode

  2. react-native run-ios

Auth0 devs: please fix the automated installer!

@ldunphy1
Copy link
Author

@lukecwilliams I'm actually running an android project. Do you have any solutions for android?

@hzalaz
Copy link
Member

hzalaz commented Mar 13, 2017

@lukecwilliams the automated installer works for iOS in the latest version also in your instructions the change in the Podfile (OneSignal) is not needed since you never perform a pod install so the Xcode project is not affected.

The only way the automated install fails if you changed something in Xcode project by hand

@ldunphy1
Copy link
Author

@hzalaz any solutions for my issue?

@hzalaz
Copy link
Member

hzalaz commented Mar 13, 2017

About the android error make sure the plugin is properly linked for android which includes it being included like stated in https://github.com/auth0/Mobile-Samples.React/issues/11#issuecomment-281495729 because that error means that react native could not find the native module.

@hzalaz
Copy link
Member

hzalaz commented Mar 13, 2017

@ldunphy1 last week tried the install from scratch (using react-native cli project creator) and it worked without issues in both platforms (tested on Mac not sure that matters)

@ldunphy1
Copy link
Author

I don't have a Mac. I have Windows.

@lukewlms
Copy link

@hernan-m87 Thanks for the response. Good to know 'OneSignal' is unnecessary to add.

The automated installer definitely added the two new libraries with an extra "../" in each header path that I had to manually remove.

@ldunphy1
Copy link
Author

I tried on a friends computer (also windows os), to make sure it's not just my machine. It also wasn't working

@hzalaz
Copy link
Member

hzalaz commented Mar 13, 2017

@ldunphy1 did perform the first step of https://github.com/auth0/react-native-lock#react-native-cli-1 ?

@ldunphy1
Copy link
Author

Now I'm back to this issue that was never answered: #129

@hzalaz hzalaz closed this as completed Mar 13, 2017
@StevenFrostwick
Copy link

Just in case any one else comes along:

I was also getting these errors (missing Lock/Lock.h etc.) and had to change the Header Search Paths to

$(SRCROOT)/../../React
$(SRCROOT)/../../react-native/React
${SRCROOT}/../../../ios/Pods/Headers/Public
${SRCROOT}/../../../ios/Pods/Headers/Public/Lock

BTW I was getting these errors whether I followed the react-native-cli or Manual instructions.

@lukewlms
Copy link

lukewlms commented Mar 14, 2017

@StevenFrostwick My working first line there has 3 "directory up" commands, does yours work with just 2?

I have:
$(SRCROOT)/../../../React

Rest are the same.

@StevenFrostwick
Copy link

StevenFrostwick commented Mar 14, 2017

Yeah two ../

Which seems to make sense as React is two levels up from the A0RNLock.xcodeproj file.

@smooJitter
Copy link

Can I confirm, if I install manually, do I still need a pod file?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants