Theos iOS 11 system() function

亡梦爱人 提交于 2019-12-08 07:52:34

问题


I updated my Phone to IOS 11 and the system() function is not supported anymore. I want to shutdown after pressing a button, how can I do that? Respring works fine with posix_spawn. My old code is:

(void)shutdownButtonPressed{
    system("shutdown");
}

回答1:


From the shutdown source, it would seem the proper way of doing this is:

#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);
}


来源:https://stackoverflow.com/questions/53922933/theos-ios-11-system-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!