Forum Xamarin.iOS

How to handle async tasks

Programmer16Programmer16 USMember ✭✭


I've been trying to debug this asynchronous call I'm working with with an external service, Pubnub ( and I'm trying to tackle it from two angles. I seem to be running into a question that might be Xamarin-related, so I am going to post it here.

I'm running the code as mentioned in the link in my question, and in my Xamarin debug window, I am seeing

Thread started: <Thread Pool> #9
Thread started: <Thread Pool> #10
Thread started: <Thread Pool> #11
Thread finished: <Thread Pool> #10
Thread finished: <Thread Pool> #11
Thread finished: <Thread Pool> #9

My code never seems to execute, and I don't know if I need to handle asynchronous functions differently in Xamarin, or if it's even possible. The application seems to hang when I stick the code in a TouchUpInside event in my ViewController

button.TouchUpInside += delegate {
        .IncludeState(true) // include state with request (false by default)
        .IncludeUUIDs(true) // if false, only shows occupancy count
        .Async(new DemoHereNowResult());


public class DemoHereNowResult : PNCallback<PNHereNowResult> {
    public override void OnResponse(PNHereNowResult result, PNStatus status) {

Does anyone have ideas?


Best Answer


Sign In or Register to comment.