took me forever but I hope this helps someone else.
For Kivy-iOS, this needs to be entered into the main.m file in Xcode, at the bottom of the main() function.
int main(int argc, char *argv[]) {
int ret = 0;
that's the start of main()
then all the main code, with the following code near the bottom.
// If other modules are using the thread, we need to initialize them before.
PyEval_InitThreads();
// Add an importer for builtin modules
load_custom_builtin_importer();
then, You need to put the below code after that
// Prevent sleep
[NSTimer scheduledTimerWithTimeInterval:2.0 repeats:YES block: ^(NSTimer * _Nonnull timer) {
[UIApplication sharedApplication].idleTimerDisabled = NO;
[UIApplication sharedApplication].idleTimerDisabled = YES;
NSLog(@"idle timer");
}];
NSLog(@"Initializing python");
Py_Initialize();
hope this helps someone else.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: