Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS: the update modal not shown as android #189

Open
MostafaHamdy3 opened this issue Oct 5, 2024 · 0 comments
Open

IOS: the update modal not shown as android #189

MostafaHamdy3 opened this issue Oct 5, 2024 · 0 comments

Comments

@MostafaHamdy3
Copy link

I add this in info.plist

<key>LSApplicationQueriesSchemes</key>
	<array>
		<string>itms-apps</string>
	</array>

This is my function in the main screen

  const checkForUpdates = () => {
    const inAppUpdates = new SpInAppUpdates(false);

    // curVersion is optional if you don't provide it will automatically take from the app using react-native-device-info
    inAppUpdates
      .checkNeedsUpdate()
      .then((result) => {
        if (result.shouldUpdate) {
          const updateOptions = Platform.select({
            android: {
              updateType: IAUUpdateKind.IMMEDIATE,
            },
            ios: {
              title: i18n.t("UpdateAvailableTitle"),
              message: i18n.t("UpdateAvailableMsg"),
              buttonUpgradeText: i18n.t("Update"),
              buttonCancelText: i18n.t("Cancel"),
            },
          });
          inAppUpdates.startUpdate(updateOptions);
        }
      })
      .catch((err) => {
        console.log("checkForUpdates ERROR ==>", err);
      });
  };

I called it in useEffect, but it works on Android only, IOS it doesn't show

"react-native": "0.66.5",
"sp-react-native-in-app-updates": "^1.4.0",
"react-native-device-info": "^8.0.0",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant