NSRunLoop.Main.AddTimer ignoring the timer on IPAD

xardalodinxardalodin ✭✭Member ✭✭

hi

only have a Ipad to test on for the moment..

  //TimeSpan interval = new TimeSpan(0, 1, 15, 0, 0);

            NSTimer timer = NSTimer.CreateRepeatingTimer((60*30), t =>
            {
                start2();
            });

            NSRunLoop.Main.AddTimer(timer, NSRunLoopMode.Common);

how do I get it to RUN the timer ? and not just trigg all the time..

Best Answer

  • xardalodinxardalodin ✭✭ ✭✭
    Accepted Answer

    can confirm it installs multile timers.. so have to uninstall app , everytime.

Answers

  • LucasZhangLucasZhang Xamurai Member, Xamarin Team Xamurai

    If you want to start the timer ,call the method

    timer.Fire();
    
  • xardalodinxardalodin ✭✭ Member ✭✭
        NSTimer timer = NSTimer.CreateRepeatingScheduledTimer((60*30), t =>
                {
                    start2();
                });
                timer.Fire();
                NSRunLoop.Main.AddTimer(timer, NSRunLoopMode.Common);
    

    still ignoring the timer and firing like ones every 20 sec ,, and not ones every 30 min ,

  • LucasZhangLucasZhang Xamurai Member, Xamarin Team Xamurai

    Can you provide more codes or sample ? Your code works fine on my side .

  • xardalodinxardalodin ✭✭ Member ✭✭

    I think I found the bug ,, I disabled the code , and hit debug on ipad , it keapt going with the notifications.
    so every time I debug, it installs a new timer(I think). so I have to reinstall the app probable.
    going to try to recreate it now.

  • LucasZhangLucasZhang Xamurai Member, Xamarin Team Xamurai
    edited June 17

    Glad you solve the issue.You can accept any post which helps you :smiley:

  • xardalodinxardalodin ✭✭ Member ✭✭
    Accepted Answer

    can confirm it installs multile timers.. so have to uninstall app , everytime.

Sign In or Register to comment.