Xamarin.ios寻求权限的适当位置

问题描述 投票:0回答:1

我需要使用Xamarin.Essentials在Xamarin.iOS应用程序中请求权限。到目前为止,我发现的所有示例都是关于Xamarin.Forms的,我没有使用过。]

到目前为止,我发现的所有示例都是关于在按下按钮时询问权限,这对于实验来说是很好的,但对于生产应用程序来说是没有用的。

我有以下异步代码:

// TODO Move the permission requests to a more appropriate location?
var status = await Permissions.CheckStatusAsync<Permissions.Camera>();

if (status != PermissionStatus.Granted)
{
    status = await Permissions.RequestAsync<Permissions.Camera>();
}
status = await Permissions.CheckStatusAsync<Permissions.Microphone>();
{
    status = await Permissions.RequestAsync<Permissions.Microphone>();
}

我是从ViewDidLoad异步替代调用它的。每当我调用Permissions.RequestAsync()

时,应用程序就会崩溃并显示以下输出
2020-05-08 10:21:05.815 yaka[714:200964] error: * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/ios/release/mono/mini/debugger-agent.c:4568, condition `array->len == 1' not met
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1014e7754: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x101065470: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x10123472c: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x101064370: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1014ab360: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1015ac108: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1015592a0: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x101559224: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x10105f0c0: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1014ab360: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1014e7754: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x101065470: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x10123472c: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x101064370: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1014ab360: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1015ac108: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1015592a0: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x101559224: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x10105f0c0: 8
[PLCrashReport] plframe_cursor_read_dwarf_unwind_int:131: Failed to find FDE the current frame pc: 0x1014ab360: 8

我的info.plist包含有关权限的以下内容:

<key>NSCameraUsageDescription</key>
<string>L&apos;accès est réservé au vidéoconférences.</string>
<key>NSMicrophoneUsageDescription</key>
<string>L&apos;accès est réservé au vidéoconférences.</string>

必须有适当的位置才能安全地调用此编码,但我不知道。

感谢任何帮助。

我需要在具有Xamarin.Essentials的Xamarin.iOS应用程序中请求权限。到目前为止,我发现的所有示例都与我未使用的Xamarin.Forms有关。到目前为止,我已经找到的所有样本...

c# ios xamarin.ios xamarin.essentials
1个回答
0
投票

您不需要iOS的特定代码。这就是Essentials

© www.soinside.com 2019 - 2024. All rights reserved.