Tom S.
Tom S.

Reputation: 13

Theos iOS 11 system() function

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

Upvotes: 1

Views: 371

Answers (1)

Siguza
Siguza

Reputation: 23880

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

Upvotes: 2

Related Questions