Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

UI Thread error calling a dependency service (iOS, PhotoKit) AFTER update to iOS 9.1

$
0
0

Hi all,

I don't know if I did it wrong, but before updating to iOS 9.1 I was able to call a dependency service (using the PhotoKit) for iOS like this:

CameraRollResult cameraRollResult = await Task.Run (async () => await this.IterateCameraRoll ()); 

(the dependency service is called in the IterateCameraRoll() method)
While iterating thru the camera roll a waiting page with a spinning circle was displayed.

No after updating to iOS 9.1 I am getting the following error:

==> UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.

I have to change my code to this:

CameraRollResult cameraRollResult = await this.IterateCameraRoll ();

But calling it like this obviously the waiting page is not displayed because the iterating job is not done in a separate thread.
I tried something like this:

Device.BeginInvokeOnMainThread (async () => 
{
...

But I had no success.

Does anyone have any idea how to call the method in a separate thread displaying the waiting page or do I understand something wrong ?

Thanx

Marco


Viewing all articles
Browse latest Browse all 75885

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>