From 4510236ef72837ec0f4cb359cae1dc371685c804 Mon Sep 17 00:00:00 2001 From: redth Date: Fri, 14 Oct 2022 22:39:30 -0400 Subject: [PATCH] Get elements on UIThread iOS --- src/Agent/Apple/iOSApplication.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Agent/Apple/iOSApplication.cs b/src/Agent/Apple/iOSApplication.cs index c013d72..3ebfc00 100644 --- a/src/Agent/Apple/iOSApplication.cs +++ b/src/Agent/Apple/iOSApplication.cs @@ -42,7 +42,12 @@ public override async Task GetProperty(string elementId, string property public override Task> GetElements() { - var root = GetRootElements(-1); + IEnumerable root = Enumerable.Empty(); + + UIApplication.SharedApplication.InvokeOnMainThread(() => + { + root = GetRootElements(-1); + }); return Task.FromResult(root); }