准备用于生产的移动应用Prepare mobile apps for production

本文详细介绍了如何在将移动应用移到生产环境之前提高移动应用的质量和可靠性。This article provides details about how to improve the quality and reliability of your mobile app before you move it to production.

处理错误Handle errors

在为生产准备移动应用时,可能会出现几个错误情况。As you prepare a mobile app for production, several error conditions can occur. 要处理的主要情况是无提示失败和回退到交互。The main cases you'll handle are silent failures and fallbacks to interaction. 应考虑的其他情况包括无网络情况、服务中断、管理员同意的要求以及其他特定于场景的情况。Other conditions that you should consider include no-network situations, service outages, requirements for admin consent, and other scenario-specific cases.

对于每个 Microsoft 身份验证库 (MSAL) 类型,可以找到说明如何处理错误情况的示例代码和 wiki 内容:For each Microsoft Authentication Library (MSAL) type, you can find sample code and wiki content that describes how to handle error conditions:

缓解和调查问题Mitigate and investigate issues

若要更好地诊断应用中的问题,请收集数据。To better diagnose issues in your app, collect data. 有关可以收集的数据类型的信息,请参阅 MSAL 应用程序中的日志记录For information about the kinds of data that you can collect, see Logging in MSAL applications.

一些数据收集建议如下:Here are some suggestions for data collection:

  • 用户在有问题时可能会寻求帮助。Users might ask for help when they have problems. 最佳做法是捕获日志并将其临时存储。A best practice is to capture and temporarily store logs. 提供一个供用户上传日志的位置。Provide a location where users can upload the logs. MSAL 提供日志记录扩展来捕获有关身份验证的详细信息。MSAL provides logging extensions to capture detailed information about authentication.

  • 如果遥测可用,请通过 MSAL 启用它,以收集有关用户如何登录应用的数据。If telemetry is available, enable it through MSAL to gather data about how users sign in to your app.

后续步骤Next steps

使应用程序变得出色:Make your application great:

测试集成:Test your integration:

若要尝试其他示例,请参阅桌面和移动公共客户端应用To try out additional samples, see Desktop and mobile public client apps.