SudoPlz / sp-react-native-in-app-updates

An in-app updater for the native version of your react-native app.
MIT License
459 stars 65 forks source link

Couldn't fetch the latest version #69

Open Naveenchandar opened 2 years ago

Naveenchandar commented 2 years ago

Hi, I've tried following example code mentioned in example folder in my project but it doesn't get the latest version from playstore. It always throws error as '"other": {"updateIsAvailable": false}, "reason": "Couldn't fetch the latest version", "shouldUpdate": false}". In package.json file version is '0.0.1' and android/gradle file I've changed the version as '1.1.5' and Info.plist ios file, I've changed CFBundleShortVersionString as '1.1.5'. Apk latest version is 1.1.7 (available in playstore).

How exactly version check works. ?

Here's the sample code I've tried.

checkForUpdates = async () => {
        try {
            console.log("========== appUpdate", DeviceInfo.getVersion());
            const appUpdate = await this.inAppUpdates
                .checkNeedsUpdate({
                    curVersion: DeviceInfo.getVersion() //'1.1.5'
                });
            console.log("========== appUpdate", appUpdate);
        } catch (error) {
            console.log('========= error =======', error);
        }
    };
bohdankonovalov commented 2 years ago

Same issue, any solutions?

Naveenchandar commented 2 years ago

Till now I haven't got solution yet.

shubhamraka08 commented 2 years ago

still not resolved.

monireamini commented 2 years ago

If your app is available only in one country, the country field must be provided for the startUpdate and checkNeedsUpdate methods. By doing so, you can see the update alert on your ios device.

lagoasoft-yagosantos commented 2 months ago

still having this problem, our app is available in many countries, any suggestions in this case?

a-eid commented 1 month ago

same issue for us as well.

ali-kamranch commented 1 month ago

@lagoasoft-yagosantos were you able to solve this? Our app is also available in multiple countries.

lagoasoft-yagosantos commented 3 days ago

@lagoasoft-yagosantos were you able to solve this? Our app is also available in multiple countries.

I just made function to get the user device region and compare with the list of the available countries, passing a default country as a fallback country: getDeviceRegion(AVAILABLE_COUNTRIES_LIST, DEFAULT_COUNTRY), but unfortunately i couldn't test this properly, have no idea if its working as it should since is hard to test this on IOS and I haven't had much time to check it as well