michalchudziak / react-native-geolocation

Geolocation APIs for React Native
MIT License
1.28k stars 220 forks source link

When I try to use it, it constantly says You have run 'pod install'. #258

Closed yuntaengtaeng closed 1 year ago

yuntaengtaeng commented 1 year ago

version information

name version
react "17.0.2"
react-native "0.68.2"
"@react-native-community/geolocation" "^3.0.6"

command I entered

npm install @react-native-community/geolocation --save cd ios && pod install

additional settings

android

AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

ios

info.plist

    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string></string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string></string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string></string>

React Native Code

import Geolocation from '@react-native-community/geolocation';

  useEffect(() => {
    console.log(Geolocation);
  }, []);

error occurre

 ERROR  Error: The package '@react-native-community/geolocation' doesn't seem to be linked. Make sure: 

- You have run 'pod install'
- You rebuilt the app after installing the package
- You are not using Expo managed workflow
, js engine: hermes
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

How I tried to fix the error

1.

react-native start --reset-cache

2.

Project > iOS > Podfile add

pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'

I tried these methods but couldn't solve it. Any help would be appreciated.

michalchudziak commented 1 year ago

Can you share the contents of your Podfile?

michalchudziak commented 1 year ago

Make sure the module is linked properly, you can read more about auto linking here. Closing