我将手机更新为IOS 11,不再支持system()功能。我想在按下按钮后关机,我该怎么做?使用posix_spawn可以正常响应。我的旧代码是:
(void)shutdownButtonPressed{
system("shutdown");
}
从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);
}