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" !?!
-
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 !
-
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
-
UIApplication = ObjCClass('UIApplication') My_app = UIApplication.sharedApplication() My_app.idleTimerDisabled = True
-
@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 :)