Theos iOS 11 system()函数

问题描述 投票:1回答:1

我将手机更新为IOS 11,不再支持system()功能。我想在按下按钮后关机,我该怎么做?使用posix_spawn可以正常响应。我的旧代码是:

(void)shutdownButtonPressed{
    system("shutdown");
}
objective-c iphone ios11 jailbreak theos
1个回答
2
投票

the shutdown source来看,这样做的正确方法似乎是:

#define RB_HALT 0x08
extern void* reboot3(int how);

(void)shutdownButtonPressed {
    // for a real reboot, just pass 0 instead of RB_HALT
    reboot3(RB_HALT);
}
© www.soinside.com 2019 - 2024. All rights reserved.