Commit fd09bc18 authored by CodeCrafter912's avatar CodeCrafter912

ios devices are not going to sleep anymore when running the app

parent 6db7e1fc
......@@ -6,6 +6,9 @@
#include <QScreen>
#include "baseconn.h"
#if defined(Q_OS_IOS)
#include "sleepprevent.h"
#endif
int main(int argc, char *argv[])
{
......@@ -25,6 +28,11 @@ int main(int argc, char *argv[])
if (engine.rootObjects().isEmpty())
return -1;
#if defined(Q_OS_IOS)
SleepPrevent sp;
sp.setTimerDisabled();
#endif
// move the cursor into an invisible position
QScreen *screen = QGuiApplication::primaryScreen();
QRect rect = screen->geometry();
......
class SleepPrevent
{
public:
void setTimerDisabled();
};
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#include "sleepprevent.h"
void SleepPrevent::setTimerDisabled() {
[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
}
......@@ -54,5 +54,11 @@ contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
ios {
QMAKE_ASSET_CATALOGS += icon/Assets.xcassets
xcode_product_bundle_identifier_setting.value = "de.itsblue.ScStwMonitor"
OBJECTIVE_SOURCES += \
sleepprevent.mm
OBJECTIVE_HEADERS += \
sleepprevent.h
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment