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: OpenAppInStore() does not work #6

Closed
simader opened this issue May 29, 2018 · 14 comments
Closed

iOS: OpenAppInStore() does not work #6

simader opened this issue May 29, 2018 · 14 comments
Assignees
Labels

Comments

@simader
Copy link

simader commented May 29, 2018

Bug

When I call await CrossLatestVersion.Current.OpenAppInStore(); on my Iphone SE it opens the store but it says "Cannot connct to App Store"

Plugin Version: newest
Platform (e.g., Android v21):
Device/Hardware: IPhone SE

Expected behavior

navigates to the app.

Actual behavior

@RazvanEmilR
Copy link

Was this fixed?

@simader
Copy link
Author

simader commented Oct 24, 2018

There was no reaction so far. Still the same behaviour

@nmano2188
Copy link

Same issue..

@edsnider
Copy link
Owner

I looked into this issue and it worked for me. However, I did notice some inconsistencies with the URL the library uses to open the app in the App Store depending on the specific app, app name and version of iOS.
Which version of iOS are you all seeing this issue on?

@pfbwitz
Copy link

pfbwitz commented Dec 18, 2018

I looked into this issue and it worked for me. However, I did notice some inconsistencies with the URL the library uses to open the app in the App Store depending on the specific app, app name and version of iOS.
Which version of iOS are you all seeing this issue on?

12.0 (16A366))

@simader
Copy link
Author

simader commented Dec 18, 2018

I experienced some strange behavior if the CFBundleIdentifier contains some special characters like a dot.
I changed our CFBundleName to a Name without dot and then at least it is found in the search.

@edsnider edsnider added the ios label Dec 28, 2018
@vinicius-stutz
Copy link

vinicius-stutz commented Mar 28, 2019

Hi! I get the error message in iOS: "Error parsing content from the App Store" when call await CrossLatestVersion.Current.IsUsingLatestVersion(); SDK 12.1

In the play store works well (Android).

@kainaalmeida
Copy link

I looked into this issue and it worked for me. However, I did notice some inconsistencies with the URL the library uses to open the app in the App Store depending on the specific app, app name and version of iOS.
Which version of iOS are you all seeing this issue on?

iPhone SE 12.0

@AnthonyLatty
Copy link

This seems to still be a valid issue, are there any work arounds??

@prash6001
Copy link

Not yet fixed? Any solution on this?

@TheSayvior
Copy link

TheSayvior commented Feb 19, 2020

The problem arises in the iOS when the URL is created
UIKit.UIApplication.SharedApplication.OpenUrl(new NSUrl($"http://appstore.com/{appName}"));

the url needs to be exstended with the apple ID of the app, you can find the ID in the AppStoreConnect page of your app at the general information.

I cant get UIKit.UIApplication.SharedApplication.OpenUrl(new NSUrl($"http://appstore.com/{appName}/id{AppId}")); to work, therefore i only make use of the version retrieval code and then make sure of
Xamarin.Essencials.Launcher.openAsync(new Uri("https://apps.apple.com/dk/app/{AppName}/id{AppId}")); instead on the common side code and checking the Device.RunetimePlatform == Device.iOS before calling it

@TheSayvior
Copy link

TheSayvior commented Feb 20, 2020

I got the t UIKit.UIApplication.SharedApplication.OpenUrl method to work. It must be updated with the new path such that
http://appstore.com/{appName}
is replaced with
https://apps.apple.com/dk/app/{AppName}/id{AppId} (remember to add the AppId wont happen automatically)

Additionally the code dosent take into acount none english characters so the, MakeSafeForAppStoreShortLinkUrl(string value) must be updated, in my case my app name has a "ø" which isent allowed.
therefore update the method with:
` private string MakeSafeForAppStoreShortLinkUrl(string value)
{
...
var safeValue = regex.Replace(value, string.Empty);

                    safeValue = safeValue.Replace(" ", string.Empty)
                             .Replace("&", "and")
                             .Replace("å", "a")
                             .Replace("ø", "o")
                             .Replace("æ", "ae")
                             .ToLower();

        return safeValue;
    }`

Should you only choose to update the MakeSafeForAppStoreShortLinkUrl method then the call to the app will work but it will show up as a search and you will be subject to commercials in the store.

@TheSayvior
Copy link

Another way of doing it would be to create a copy of the GetLatestVersionNumber as a private method and calling it GetAppStoreUrl you should then replace the return property ["version"] with ["trackViewUrl"] and you can then use the result of that in your app store request
string storeUrl = await GetAppStoreUrl(BundleIdentifier); UIKit.UIApplication.SharedApplication.OpenUrl(new NSUrl(storeUrl));

@edsnider edsnider self-assigned this Feb 25, 2020
@edsnider
Copy link
Owner

Fix is available in latest nuget beta - https://www.nuget.org/packages/Xam.Plugin.LatestVersion/2.0.0-beta.76

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

No branches or pull requests

10 participants