Hi…
Hope someone can help me get started on implementing the declares to control idleTimerDisabled…
Thanks,
Jim
Hi…
Hope someone can help me get started on implementing the declares to control idleTimerDisabled…
Thanks,
Jim
Try this:
Function SetIdleTimerDisabled(disabled as boolean)
declare sub setIdleTimerDisabled lib "UIKit" selector "setIdleTimerDisabled:" (obj_id as ptr, disabled as boolean)
declare function sharedApplication lib "UIKit" selector "sharedApplication" (clsRef as ptr) as ptr
declare function NSClassFromString lib "Foundation" (clsName as cfstringref) as ptr
setIdleTimerDisabled(sharedApplication(NSClassFromString("UIApplication")), disabled)
End Function
Jason… I owe you one… thanks
You’re welcome
Hi folks, I’m resurrecting this thread because somewhere between Xojo 2019 r1.1 and 2019 r3.1 it started causing a hard crash in iOS 13. I’ve verified this with iOS 13.3 in the Simulator (because my main computer is on macOS 10.14) and 13.5.1 on a real device.
Does anyone have an alternative way of toggling the idle timer that works with the current version of Xojo?
[code]Application Specific Information:
*** Terminating app due to uncaught exception ‘NSInternalInconsistencyException’, reason: ‘threading violation: expected the main thread’
terminating with uncaught exception of type NSException
abort() called
CoreSimulator 681.17.2 - Device: iPhone 8 (FEEC7F56-B9FD-4450-81E4-6E7B393E096D) - Runtime: iOS 13.3 (17C45) - DeviceType: iPhone 8
Application Specific Backtrace 1:
0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48
2 CoreFoundation 0x00007fff23c70ff8 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff256e9b51 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 FrontBoardServices 0x00007fff366219cb -[FBSSerialQueue assertOnQueue] + 236
5 FrontBoardServices 0x00007fff365d46f9 -[FBSSceneImpl updateClientSettings:withTransitionContext:] + 70
6 FrontBoardServices 0x00007fff365d4944 -[FBSSceneImpl updateClientSettingsWithTransitionBlock:] + 154
7 FrontBoardServices 0x00007fff365d4869 -[FBSSceneImpl updateClientSettingsWithBlock:] + 110
8 UIKitCore 0x00007fff47bd9088 -[FBSScene(UIApp) updateUIClientSettingsWithBlock:] + 160
9 UIKitCore 0x00007fff48087f46 -[UIApplication _setIdleTimerDisabled:forReason:] + 198
10 Light Blue.debug 0x0000000100a3523a miscFunctions.setIdleTimer%%b + 506
11 Light Blue.debug 0x0000000100bc77ae dataSyncThreadClass.sendData%%o + 5182
12 Light Blue.debug 0x0000000100b892eb dataSyncThreadClass.Event_Run%%o + 763
13 rbframework.dylib 0x000000010155f355 Thread_Run + 730
14 libsystem_pthread.dylib 0x00007fff524602eb _pthread_body + 126
15 libsystem_pthread.dylib 0x00007fff52463249 _pthread_start + 66
16 libsystem_pthread.dylib 0x00007fff5245f40d thread_start + 13[/code]