为 iOS Xamarin 表单执行远程生成时出现棱镜导航错误



我已经将我的Visual Studio与虚拟MAC机器配对,创建了所需的钥匙串,并添加到我的项目中。我不断收到此错误:

Prism.Navigation.NavigationException: An error occurred while resolving the page. This is most likely the result of invalid XAML or other type initialization exception --->
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: 
Exception has been thrown by the target of an invocation. ---> Microsoft.Identity.Client.MsalClientException: The application cannot access the iOS keychain for the application publisher (the TeamId is null). This is needed to enable Single Sign-On between applications of the same publisher.

我也尝试在Entitlements.plist中禁用钥匙串 - 不起作用。不知何故,这似乎是一个 Prism 导航问题,因为当我消除它并简单地导航到示例页面时,它可以工作。

我还尝试在物理Mac上运行我的项目,我得到这个:

2020-06-01 01:45:29.879475-0700 NatWest.KeepSafe.MobileApp.iOS[6277:128192] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=6277
2020-06-01 01:45:29.880109-0700 NatWest.KeepSafe.MobileApp.iOS[6277:128192] SecTaskCopyDebugDescription: NatWest.KeepSafe[6277]/0#-1 LF=0
2020-06-01 01:45:29.897634-0700 NatWest.KeepSafe.MobileApp.iOS[6277:128192] SecTaskLoadEntitlements failed error=22 cs_flags=200, pid=6277
2020-06-01 01:45:29.897992-0700 NatWest.KeepSafe.MobileApp.iOS[6277:128192] SecTaskCopyDebugDescription: NatWest.KeepSafe[6277]/0#-1 LF=0

PS:代码在物理iPhone上运行完美,但在模拟器上运行时会出现问题。

这与棱镜完全无关。MSAL实际上与棱镜一起工作得很好,你可以看到AP。AzureADAuth Module 示例。

您发布的错误实际上准确地告诉您问题是什么。您的权利存在问题,导致它无法在 iOS 模拟器上运行。

有关更多信息,您需要在此处查看文档:

  • https://learn.microsoft.com/en-us/azure/active-directory/develop/msal-net-xamarin-ios-considerations
var builder = PublicClientApplicationBuilder
.Create(ClientId)
.WithIosKeychainSecurityGroup("com.microsoft.adalcache")
.Build();

在您的Entitlements.plist中,您需要更新为以下内容:

<dict>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.microsoft.adalcache</string>
</array>
</dict>

相关内容

  • 没有找到相关文章

最新更新