You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MAUI应用iOS端MSAL单点登录异常问题求助

MAUI iOS平台SSO登录异常解决指南

我开发的MAUI SSO(单点登录)应用在Android端登录完全正常,但iOS端登录时抛出异常,错误截图如下:
iOS SSO登录错误截图

已将Entitlement.plist添加到Bundle签名的自定义权限中,文件内容如下:

<plist version="1.0">
  <dict>    
    <key>keychain-access-groups</key>
     <array>
       <string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
     </array>
    </dict>
  </plist

排查修复步骤:

  1. 修复plist语法错误
    你的Entitlement.plist末尾标签不完整,缺少闭合的>,正确结尾应为</plist>。语法错误会导致iOS无法解析权限配置,直接引发登录异常。修正后的完整文件:

    <plist version="1.0">
      <dict>    
        <key>keychain-access-groups</key>
         <array>
           <string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
         </array>
        </dict>
      </plist>
    
  2. 验证钥匙串组与SDK配置匹配
    如果使用MSAL/ADAL SDK,确保初始化时指定的KeychainSecurityGroup参数和plist中的$(AppIdentifierPrefix)com.microsoft.adalcache完全一致,SDK需要对应权限才能访问钥匙串存储登录态。

  3. 确认签名配置正确性
    在Visual Studio的iOS项目签名设置中:

    • 勾选"启用钥匙串共享",并确保列表中包含$(AppIdentifierPrefix)com.microsoft.adalcache
    • 确认自定义权限文件的路径正确,未出现路径拼写错误或文件未被正确引用
  4. 清理重建项目
    删除iOS项目的bin和obj目录,清理NuGet缓存后重新编译部署,避免旧的缓存配置干扰新的权限设置。

内容的提问来源于stack exchange,提问作者Xamarin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 02:25:14