question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In IOS getLatestVersion is not working

See original GitHub issue

I tried following for IOS:

===================== First Method =============================

VersionCheck.getLatestVersion({ provider: ‘appStore’ // for Ios }) .then(latestVersion => { console.log(latestVersion); });

===================== Second Method ===========================

VersionCheck.getLatestVersion().then(latestVersion => { console.log(latestVersion);
});

===================== Third Method ===========================

VersionCheck.getLatestVersion({ forceUpdate: true, provider: () => fetch(https://itunes.apple.com/${countryCode}lookup?bundleId=${packageName}) .then(r => r.json()) .then(({version}) => version) }).then(latestVersion =>{ console.log(latestVersion); });

  • Nothing get Response as Latest Verison of IOS App from appstore.

  • @kimxogus suggest any additional parameters or api changes for get latest version info

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

15reactions
jessejiang0214commented, Feb 14, 2020

Hi @ChandreshRana ,

I fixed this issue yesterday, but it looks like not this component issue, it’s iTunes API’s issue.

If you check the provider, you will find that the countryCode is all uppercase like “AU”, the funny thing is if you put AU into query url like https://itunes.apple.com/AU/ookup?bundleId=${packageName}, it returns the previous version, for example, 1.2.33. But as I release the new version 1.2.34 in the morning that query still returns me 1.2.33 If the query is https://itunes.apple.com/au/ookup?bundleId=${packageName}, lowercase au. That can return 1.2.34

So the solution is we provide country as the parameter. like VersionCheck.getLatestVersion({country:‘au’})

1reaction
aperomingocommented, Apr 19, 2021

Update: previous method doesn’t work on iOS Release (App Store) but yes on Debug and Release using simulator/physical iPhone… Android is OK

On testing now:

  getIosProvider(iosUpdateUrl) {
    return () =>
      fetch(iosUpdateUrl).then((response) =>
        response?.json()?.then((info) => (info?.resultCount > 0 ? info.results[0].version : null)),
      );
  }

  updateAppMessage(iosUpdateUrl) {
    return VersionCheck.needUpdate({
      provider: Platform.OS === 'ios' ? this.getIosProvider(iosUpdateUrl) : 'playStore',
    })
      .then(async (res) => {
        return typeof res?.isNeeded === 'boolean' ? res?.isNeeded : false;
      })
      .catch((error) => {
        console.log('error taking app version', error);
        return false;
      });
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

can't get latest version for iPhone 3G - Apple Community
can't get latest version for iPhone 3G. I have the latest iTunes version 10.4.1, but when I check the latest version for my...
Read more >
react native version check package make app crash
There has been some unresolved issues regarding this package and especially those ... You can get latest version from your own api.
Read more >
react-native-version-check - Bountysource
In IOS getLatestVersion is not working $ 0. Created 2 years ago in kimxogus/react-native-version-check with 6 comments. I tried following for IOS ...
Read more >
react-native-version-check - npm
Start using react-native-version-check in your project by running ... or npm install $ react-native run-android # or react-native run-ios ...
Read more >
How to get latest version of iOS in iPhone [2022] - Compsmag
How to install iOS update using your Mac. If you have limited space on your device or the software update is not working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found