您的位置:首页 > 其它

mac 强制关闭应用程序_强制更新您的应用程序应符合行业标准

2020-08-21 14:53 441 查看

mac 强制关闭应用程序

As a back-end and app developer, I have seen several software bugs that required either the app or the back end to be fixed. In some of those cases, the cleanest way to fix the issue was to update the app. But since we did not have a way to force an update of our app, I had to hack a fix into the endpoint on the back-end code. This is never optimal and heavily decreases the codebase’s quality over time.

作为后端和应用程序开发人员,我已经看到了一些需要修复应用程序或后端的软件错误。 在某些情况下,解决问题的最干净方法是更新应用程序。 但是由于没有办法强制更新应用程序,因此我不得不在后端代码的端点上破解了一个修补程序。 这从来都不是最佳选择,并且会随着时间的推移严重降低代码库的质量。

What if I have to fix the same endpoint a second time because the fixed app version has another bug? I can’t just always put a patch on the patch and hope that the next developer who touches the code knows what all those

if-elses
and checks are about. Also, creating more and more endpoints labeled “v1,” “v2,” “vN” doesn’t cut it for me either. It blows up the available number of endpoints and the lines of code in our codebase — and all that just because I have to make sure that old apps still work correctly with my back end.

如果由于固定的应用程序版本存在另一个错误,我不得不第二次修复同一终结点,该怎么办? 我不能总是在补丁上贴上补丁,并希望下一个接触代码的开发人员知道所有这些

if-elses
和check的含义。 同样,创建越来越多的标记为“ v1,” v2,“ vN”的端点对我来说也没有用。 它炸毁了我们的代码库中可用的端点数量和代码行,而所有这些仅仅是因为我必须确保旧的应用程序仍可以在后端正确运行。

How should I implement a new feature in that jungle of ugly patches and what feels like 200 different versions of the same endpoint? Which endpoint should I debug if a new issue arises?

我应该如何在那片丑陋的丛林中实现一项新功能,并且感觉同一端点有200个不同版本? 如果出现新问题,应该调试哪个端点?

Photo by mohamed_hassan on Pixabay. 由mohamed_hassan的照片· Pixabay上的免费照片

梦想 (The Dream)

From a developer's point of view, I would like to force an update of my app whenever I think that a clean solution to a problem cannot be achieved by keeping the current version of the app. I could just force-patch the app and fix the bug in a clean way on the back end that doesn’t require architecture violations or an epidemic of

if-else
-ing inside the endpoint logic.

从开发人员的角度来看,每当我认为保留当前版本的应用程序无法解决问题时,便想强制更新我的应用程序。 我可以强制修补该应用程序,并在后端以整洁的方式修复该错误,该错误不需要架构冲突或终结点逻辑中的

if-else
-ing流行。

But what does that mean for the user? Are forced updates too intrusive?

但这对用户意味着什么? 强制更新是否过于侵入性?

In my opinion, it depends.

我认为这取决于。

  • If you are pushing out an app update that fixes a layout problem that just “didn’t look pretty” before, then I would say that it is enough to make the user aware of the update but not important enough to force the user to download the update.

    如果您要推出的应用程序更新解决了以前“看起来并不漂亮”的布局问题,那么我想说的是,这足以使用户意识到更新,但不足以迫使用户下载更新。
  • If the issue is of the “user orders the wrong product because of an ID mixup” category, then force-update that app as quickly as possible.

    如果问题出在“由于ID混淆,用户订购了错误的产品”类别,请尽快强制更新该应用。
fancycrave1 on fancycrave1Pixabay.Pixabay上

实施实例 (Implementation Example)

Now that we have a feeling for when to force-update and when to just notify the user about the update, let’s have a look at how to implement such a mechanism on the back end and the apps.

现在我们有了何时强制更新以及何时仅将更新通知用户的感觉,让我们看看如何在后端和应用程序上实现这种机制。

For the app to know that there is an update, we must have an endpoint on our back end that returns the latest compatible app version number. The app always has to call this endpoint when it starts or wakes up before it calls any other endpoints.

为了使应用程序知道有更新,我们必须在后端具有一个端点,该端点返回最新的兼容应用程序版本号。 在启动或唤醒该应用程序之前,该应用程序始终必须先调用此端点,然后才能调用任何其他端点。

Here is a possible example response from our hypothetical versioning endpoint:

这是来自我们假设的版本控制端点的可能示例响应:

As you can see in the example above, when our iOS app calls this endpoint, it will read the

min
version
1.0.0
and
max
version
1.1.0
. It will then compare the local version of the app with the
min
and
max
versions received from our back end.

如上例所示,当我们的iOS应用调用此终结点时,它将读取

min
版本
1.0.0
max
版本
1.1.0
。 然后,它将比较应用程序的本地版本和从后端收到的
min
max
版本。

The handling will always follow one of these cases:

处理将始终遵循以下情况之一:

  • local version == max version
    → No update available, no action required.

    local version == max version
    →无可用更新,无需任何操作。

  • local version < max version && local version > min version
    → We can show the user a dismissable pop-up inside the app to inform them that they can download an update but don’t have to.

    local version < max version && local version > min version
    →我们可以在应用程序内向用户显示一个可忽略的弹出窗口,通知他们可以下载更新,而不必这样做。

  • local version < min version
    → The app is not compatible with the back end and must be force-updated. We will show the user a modal, non-dismissable pop-up that explains that they have to update the app to be able to use it.

    local version < min version
    →该应用程序与后端不兼容,必须强制更新。 我们将向用户显示一个模态的,不可撤销的弹出窗口,该弹出窗口说明他们必须更新应用程序才能使用它。

Note: The logic is similar for an Android app.

注意:逻辑与Android应用程序相似。

应用程序用户界面示例 (App UI example)

An update is available for download and the user can choose to use the current app or update it from the App Store:

可供下载的更新,用户可以选择使用当前应用或从App Store更新:

An update is available for download. The user has to update the app and can no longer use the currently installed version. We force-update the app:

可以下载更新。 用户必须更新应用程序,并且不能再使用当前安装的版本。 我们强制更新该应用程序:

Photo by Free-Photos on Pixabay. 照片由Free-Photos· Pixabay上的免费照片

结论 (Conclusion)

When I look at this feature from the user’s point of view, it can be annoying to always be informed that there is a new update available. As a user, I sometimes won’t even have the choice to use the app and will be forced to update.

当我从用户的角度查看此功能时,总是被告知存在新的更新可能很烦人。 作为用户,有时我什至无法选择使用该应用程序,并且会被迫进行更新。

As an app publisher, I have to be careful to not overwhelm my users. Force-updating often will only annoy my users and probably drive them away from using my app. I want my users to have a good experience with my app and use it often. Therefore, interrupting the users each time they start up the app with an update pop-up should be avoided. To reduce the number of pop-ups, show the pop-up for optional updates once and only once. Allow the user to skip a version.

作为应用发布者,我必须注意不要让用户不知所措。 强制更新通常只会惹恼我的用户,并可能使他们远离使用我的应用程序的权限。 我希望我的用户对我的应用有良好的体验,并经常使用它。 因此,应避免在用户每次使用更新弹出窗口启动应用程序时中断用户。 要减少弹出窗口的数量,请一次仅显示一次可选更新的弹出窗口。 允许用户跳过版本。

Having a way to keep the codebase in the app and the back end clean is fantastic. It saves time and money, decreases the frustration of the developers, and makes supporting the app easier. That’s why I personally think that all apps should have this mechanism. Even better, Apple and Google should provide us with a built-in mechanism to make this whole process easier for developers and app users.

有一种方法可以保持应用程序中的代码库和后端整洁,这真是太棒了。 它节省了时间和金钱,减少了开发人员的挫败感,并使支持应用程序变得更加容易。 因此,我个人认为所有应用程序都应具有此机制。 更好的是,Apple和Google应该为我们提供内置机制,以使开发人员和应用程序用户整个过程变得更加轻松。

翻译自: https://medium.com/better-programming/force-update-your-apps-74de57523650

mac 强制关闭应用程序

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: