Closed msutyak closed 6 years ago
This is because the library is not properly included. Did you follow the installation instructions to the letter?
Also, are you using the latest XCode and Swift? What versions?
How are you importing Contacts
in your code?
I followed the instructions to the letter. The one issue I have is I have another package (BVLinearGradient) that is preventing my project from compiling in XCode. However, it runs just fine in the simulator when using react-native run-ios from command line. My XCode is 8 and my Swift is 3.
Hmm, take a look at https://github.com/joshuapinter/react-native-unified-contacts/issues/12 and see if anything in there is helpful.
Including a react-native library is painless when it's written in Objective-C but they still don't natively support Swift so we have to do a few more steps.
If you do find anything that helps, please post it back here or submit a PR to update the README with useful information.
I had the same problem. Then I opened the project on Xcode 8.3.2 and upgraded the project to swift 3. Made the suggested changes (Just accepted whatever questions it threw at me) and then it worked.
Just upgraded this to use Swift 4 and everything hums in XCode 9.2.
Closing this for now. Check out the latest version of the package 1.6.1 and let me know how it goes.
Thanks!
I'm using create-react-native-app...and i'm running the project from command line...
@unutoiul I don't think this is the right issue to be posting this under.
But, try following the README.md first and see how things go. At the time of writing this library, react-native link
did not support Swift libraries, which this is written in, so you need to link it manually.
how to do it manually... do I need to setup a xcode project? I don't use xcode I use the terminal and create-react-native-app
I'm using the following:
Contacts.getContacts( (error, contacts) => { if (error) { console.error(error); } else { console.log(contacts); } });
However, I am getting the error:
Cannot read property 'getContacts' of undefined
Why is this not working?