kimxogus / react-native-version-check

A version checker for react-native applications
MIT License
715 stars 171 forks source link

does not work "cannot read property country" #217

Open kriit24 opened 7 months ago

kriit24 commented 7 months ago

It does not work. Expo SDK 49. Also does not work - Unable to resolve "react-native-version-check-expo" from "App.js"

Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'country' of null TypeError: Cannot read property 'country' of null at getCountry (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:228401:44) at ?anon_0_ (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:130878:58) at next (native) at asyncGeneratorStep (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:6085:26) at _next (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:6104:29) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:6109:14) at tryCallTwo (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:61:9) at doResolve (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:216:25) at Promise (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:82:14) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:6101:25) at apply (native) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:130891:32) at apply (native) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:162297:27) at tryCallTwo (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:61:9) at doResolve (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:216:25) at Promise (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:82:14) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:162296:29) at init (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:162307:18) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:130933:23) at apply (native) at init (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:162317:24) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:162309:24) at tryCallOne (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:53:16) at anonymous (/Users/kudo/01_Work/Repos/expo/expo/android/versioned-react-native/packages/react-native/ReactAndroid/hermes-engine/.cxx/MinSizeRel/3n472i6k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:139:27) at apply (native) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:39588:26) at _callTimer (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:39467:17) at _callReactNativeMicrotasksPass (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:39512:17) at callReactNativeMicrotasks (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:39718:44) at __callReactNativeMicrotasks (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:3643:46) at anonymous (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:3417:45) at __guard (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:3616:15) at flushedQueue (http://192.168.1.100:8081/node_modules%5Cexpo%5CAppEntry.bundle//&platform=android&dev=true&hot=false&lazy=true:3416:21)

derek-primumco commented 7 months ago

This has been my experience, too.

The Android Play Store check works, but the rest of it (current version and country) doesn't seem to work.

I read this article: https://sugandsingh5566.medium.com/force-update-ensuring-your-react-native-app-stays-up-to-date-a39f5791b629

It suggests this code snippet, where /in/ is the country code for the App Store:

const latestVersioniOS = await fetch(`https://itunes.apple.com/in/lookup?bundleId= put her your bundleId like com.app`)
  .then(r => r.json())
  .then((res) => { return res?.results[0]?.version })