omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    ObjectC "idleTimerDisabled" !?!

    Pythonista
    2
    4
    2994
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BillBaroude
      BillBaroude last edited by

      Hi there,

      I'm seaeching the right way to make work an ObjectC line of code to disable the Idle timer on iPhone (screen goes darker)
      The original line of code (found on the web) is :
      [UIApplication sharedApplication].idleTimerDisabled = YES;

      My side, I can't figure out how to use this exaclty. After a bunch of tries, no way to make it works.
      Here is the non working code I tried :

      from objc_util import *

      #Switch off idle mode (ObjectC)
      UIApplication = ObjCClass('UIApplication')
      idleTimerDisabled = ObjCClass('idleTimerDisabled')
      My_app = UIApplication.sharedApplication()
      My_app.idleTimerDisabled = 'YES'

      Any idea on the way to make it work ?

      Thx !

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        The easiest way is to use the method exposed in the console module

        import console
        console.set_idle_timer_disabled(True)
        

        Otherwise, you want to use True, not YES

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          UIApplication = ObjCClass('UIApplication')
          My_app = UIApplication.sharedApplication()
          My_app.idleTimerDisabled = True
          
          1 Reply Last reply Reply Quote 0
          • BillBaroude
            BillBaroude last edited by

            @JonB said:

            mport console
            console.set_idle_timer_disabled(True)

            Thank a lot.
            I wasn't far from finding using ObjectC, but the console method is way easier :)

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB Forums | Contributors