Theos iOS 11 system()函数 [英] Theos iOS 11 system() function

查看:79
本文介绍了Theos iOS 11 system()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将手机更新为IOS 11,并且不再支持system()函数.我想在按下按钮后关机,该怎么办? Respring与posix_spawn一起正常工作.我的旧代码是:

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

推荐答案

来自

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

这篇关于Theos iOS 11 system()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆