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'accès est réservé au vidéoconférences.</string>
<key>NSMicrophoneUsageDescription</key>
<string>L'accès est réservé au vidéoconférences.</string>
これを安全にコード化するための適切な場所が必要ですが、私にはわかりません。
どんな助けでも感謝します。