Run shell commands from an app?

Discussion in 'iOS Development' started by toloratedmeat, Apr 2, 2010.

  1. toloratedmeat

    toloratedmeat New Member

    Joined:
    Mar 19, 2008
    Messages:
    43
    Likes Received:
    0
    Device:
    iPhone 3GS (White)
    Hey, I made an app for browsing real estate and when you tap on a picture of a house, it pulls a compiled file of the information and images of that house from a server.

    I noticed that the app needs to respring to detect the new file.

    It just won't work if you quit out of it then go back in.

    I was thinking of something like:
    - (IBAction) respringAction {
    id HUD = [[UIProgressHUD alloc] initWithWindow:[self view]];
    [HUD setText

    Please Register or Log in to view images

    "Reloading Data..."];
    [HUD show:YES];
    [self performSelector

    Please Register or Log in to view images

    selector(killHUD

    Please Register or Log in to view images

    withObject: HUD afterDelay:7.0];
    *killall springboard function here*
    }

    Can anyone help?
  2. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    system("killall SpringBoard");
  3. toloratedmeat

    toloratedmeat New Member

    Joined:
    Mar 19, 2008
    Messages:
    43
    Likes Received:
    0
    Device:
    iPhone 3GS (White)
    Right. And to lock / reboot / turn off the device? Just curious
  4. flyingguitar

    flyingguitar Active Member

    Joined:
    May 14, 2008
    Messages:
    1,860
    Likes Received:
    11
    Device:
    iPhone 6
    reboot:

    system("reboot")

    power off:

    system("halt")

    idk how to lock
  5. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    there is a private -[UIApplication lockDevice:] method, that presumably locks the device, though I have not tested it.
  6. toloratedmeat

    toloratedmeat New Member

    Joined:
    Mar 19, 2008
    Messages:
    43
    Likes Received:
    0
    Device:
    iPhone 3GS (White)
    Indeed. Thanks guys. I'll look into the lockDevice thing. I've got a 32GB 1st Gen ipt sitting on my desk with a broken lock button.
  7. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    You can lock the device without the physical button with SBSettings.
  8. toloratedmeat

    toloratedmeat New Member

    Joined:
    Mar 19, 2008
    Messages:
    43
    Likes Received:
    0
    Device:
    iPhone 3GS (White)
    What's the operation they use for it? I'm intrigued.
  9. Axis

    Axis Super Moderator Staff Member

    Joined:
    Dec 2, 2007
    Messages:
    6,288
    Likes Received:
    133
    Device:
    iPhone 4S (White)
    I assume it is what I posted before; that's all I could find (save for a SpringBoard routine with the same name) in my class-dumped UIKit and SpringBoard headers.
  10. toloratedmeat

    toloratedmeat New Member

    Joined:
    Mar 19, 2008
    Messages:
    43
    Likes Received:
    0
    Device:
    iPhone 3GS (White)
    Hmm. halt and reboot don't seem to work from xcode.

Share This Page