Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Appcenter分发应用内更新在Xamarin.iOS中不起作用_Xamarin_Xamarin.ios_Visual Studio App Center_Visual Studio App Center Distribute - Fatal编程技术网

Appcenter分发应用内更新在Xamarin.iOS中不起作用

Appcenter分发应用内更新在Xamarin.iOS中不起作用,xamarin,xamarin.ios,visual-studio-app-center,visual-studio-app-center-distribute,Xamarin,Xamarin.ios,Visual Studio App Center,Visual Studio App Center Distribute,我正在尝试使用VisualStudioAppCenter分发一个内部iOS应用程序(使用Xamarin.iOS构建),但似乎无法让应用程序内更新正常工作 当我下载并安装应用程序(通过电子邮件链接)时,浏览器不会打开以注册应用程序内更新,当我向该组分发新版本时,应用程序不会提供更新 我已经按照指示做了 我已经添加了info.plist条目并启动了appcenter分发模块。分析+崩溃报告工作正常,因此AppCenter ID正常 任何帮助都将不胜感激。@lavanya可能有许多不同的原因导致它们无

我正在尝试使用VisualStudioAppCenter分发一个内部iOS应用程序(使用Xamarin.iOS构建),但似乎无法让应用程序内更新正常工作

当我下载并安装应用程序(通过电子邮件链接)时,浏览器不会打开以注册应用程序内更新,当我向该组分发新版本时,应用程序不会提供更新

我已经按照指示做了

我已经添加了info.plist条目并启动了appcenter分发模块。分析+崩溃报告工作正常,因此AppCenter ID正常


任何帮助都将不胜感激。

@lavanya可能有许多不同的原因导致它们无法工作。正如你在笔记和

  • 您的测试人员是否从默认的safari浏览器下载了该应用程序

  • 是否在其设置中为Safari启用了Cookie

  • 你的应用程序在应用商店中还不可用吗


  • 你能提供更多的细节吗?因为如果您对这些问题中的任何一个回答为“否”,您将无法在iOS上使用MS App Center的应用程序内更新。如果您想创建自己的版本检查程序,在覆盖第一个视图控制器的ViewDidLoad时,您可以调用CheckVersion()函数

    然后在CheckVersion函数中,您可以执行如下操作

            public async void CheckVersion()
            {
                var newVersionAsString = new VersionObject();
                string responseContent = string.Empty;
    
                using (HttpClient httpClient = new HttpClient())
                {
                    try
                    {
                        var versionCheckUri = "https://gist.githubusercontent.com/saamerm/af01aec0187d38a22fdd9b4378afc9c3/raw/680332a9a45eb015bc17fbf817fbac537348e3d4/Version.json"
                        using (HttpResponseMessage httpResponse = await httpClient.GetAsync(versionCheckUri))
                        {
                            if (httpResponse.StatusCode == System.Net.HttpStatusCode.OK)
                            {
                                responseContent = await httpResponse.Content.ReadAsStringAsync();
                                newVersionAsString = JsonConvert.DeserializeObject<VersionObject>(responseContent);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
    
                var currentVersion = new Version(NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString());
    
                if (currentVersion != null && !string.IsNullOrWhiteSpace(newVersionAsString) && (new Version(newVersionAsString.latestVersion)) > currentVersion)
                {
                    string AppleStoreAppUrl = "itms-apps://itunes.apple.com/us/app/pages/{YOURAPPURL}?mt=8";
                    var alert = new AlertView { ViewController = this, Title = "Update Required", Message = "To continue using this mobile app, please install the latest version." };
                    alert.AddAction("Update Now", ActionStyle.Cancel, (action) => { UIApplication.SharedApplication.OpenUrl(new NSUrl(AppleStoreAppUrl)); this.Dispose(); }).Show();
                }
    

    请在使用前进行测试,我可以看到一个可能不起作用的实例

    谢谢您的回复。1.您的测试人员是否从默认的safari浏览器下载了该应用程序?是的,我们从appcenter 2分发后收到的电子邮件中下载了该应用程序。是否在其设置中为Safari启用了Cookie?是的。你的应用程序在应用商店中还不可用吗?是的,所以我首先根据文档对应用程序进行编码,然后上传版本(1.0)并分发。通过电子邮件将其安装到iPhone中。所以为了测试应用程序内更新,我上传了另一个版本(1.1)。所以现在当我打开1.0版本的应用程序时,它不会提示任何更新版本对话框。不知道发生了什么事。请帮帮我。谢谢你的帮助。@lavanya我为你所面临的一切感到抱歉。为什么不创建一个简单的Gist JSON文件,其中包含一个版本,这样应用程序就可以在每次加载应用程序时进行检查。是的,这是个好主意,但我不确定我们的应用程序如何比较版本。您知道如何在appcenter中访问最新版本的属性列表文件吗?。这样,我可以获得最新版本的版本信息,然后将其与当前应用程序包版本进行比较AppDelegate中的代码完成发布Distribute.SetEnabledAsync(true);Distribute.DontCheckForUpdatesInDebug();Distribute.ReleaseAvailable=OnReleaseAvailable;//自定义对话框bool enabled=Distribute.IsEnabledAsync().Result;AppCenter.LogLevel=LogLevel.Verbose;AppCenter.Start(“应用程序机密”、类型(分析)、类型(崩溃)、类型(分发));如果我在CodingHanks@saamer中做错了什么,请告诉我。我会在使用前测试它。谢谢你的帮助。嗨@saamer,我已经尝试了上面的代码并进行了测试,我能够获得最新版本,但是当我想下载它时,url需要是appcenter的,而不是App Store的(因为App不在App Store中)。你知道appcenter中的应用程序url吗?嗯,是的,当你从iPhone访问应用程序中心时,你的应用程序中心url是什么?嗨,Saamer,手机中的应用程序中心url显示为。不确定是否有效:)应用程序的应用程序中心URL如何?也许你没有把这些应用放在一个组织里
            public async void CheckVersion()
            {
                var newVersionAsString = new VersionObject();
                string responseContent = string.Empty;
    
                using (HttpClient httpClient = new HttpClient())
                {
                    try
                    {
                        var versionCheckUri = "https://gist.githubusercontent.com/saamerm/af01aec0187d38a22fdd9b4378afc9c3/raw/680332a9a45eb015bc17fbf817fbac537348e3d4/Version.json"
                        using (HttpResponseMessage httpResponse = await httpClient.GetAsync(versionCheckUri))
                        {
                            if (httpResponse.StatusCode == System.Net.HttpStatusCode.OK)
                            {
                                responseContent = await httpResponse.Content.ReadAsStringAsync();
                                newVersionAsString = JsonConvert.DeserializeObject<VersionObject>(responseContent);
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
    
                var currentVersion = new Version(NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString());
    
                if (currentVersion != null && !string.IsNullOrWhiteSpace(newVersionAsString) && (new Version(newVersionAsString.latestVersion)) > currentVersion)
                {
                    string AppleStoreAppUrl = "itms-apps://itunes.apple.com/us/app/pages/{YOURAPPURL}?mt=8";
                    var alert = new AlertView { ViewController = this, Title = "Update Required", Message = "To continue using this mobile app, please install the latest version." };
                    alert.AddAction("Update Now", ActionStyle.Cancel, (action) => { UIApplication.SharedApplication.OpenUrl(new NSUrl(AppleStoreAppUrl)); this.Dispose(); }).Show();
                }
    
     public class VersionObject
        {
            public string latestVersion { get; set; }
        }