Can someone give me the following code?

Discussion in 'iOS Development' started by allbrokeup, Sep 27, 2008.

  1. allbrokeup

    allbrokeup New Member

    Joined:
    Mar 7, 2008
    Messages:
    51
    Likes Received:
    0
    Binary Open Toolchain Link for Download + Tutorial?

    In the iPhone SDK, I have made an app - description withheld - and need some code for the following:

    Reboot, Hard Respring and Shut Down.

    After my app has finished downloading and processing the files, it updates itself, and I need to attach those pieces of code to my Buttons in the "What Next?" View. I have the buttons all hooked up to "Touch Up Inside" (you have dirty minds...

    Please Register or Log in to view images

    ) but my methods in Xcode are empty, I need help with this, please.

    Any help would be great.

    Please Register or Log in to view images

  2. darc10222

    darc10222 Banned

    Joined:
    Dec 24, 2007
    Messages:
    749
    Likes Received:
    0
    I only know Hard Respring, which is:
    System("killall SpringBoard")
    Or something along those lines >.>
  3. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    UPDATE: Ugh! I'm stupid! I thought you wanted the soft respring too!

    Here's Reboot:
    Code:
    system("reboot");
    That's simple ;-)

    Soft Respring:

    Code:
    #include <notify.h>
    
    /* Some Code */
    
    notify_post("com.apple.language.changed");
    Not sure if it's correct but I hope it helps anyway.

    BTW: I wouldn't try to use those commands in the SDK, Apple probably won't allow you.
    I have to admit, though, the open toolchain makes me SICK (probably because I'm too stupid to set it up correctly

    Please Register or Log in to view images

    )
  4. darc10222

    darc10222 Banned

    Joined:
    Dec 24, 2007
    Messages:
    749
    Likes Received:
    0
    Hard Respring "works" in SDK Simulator, the simulator just reports an error and crashes.
  5. allbrokeup

    allbrokeup New Member

    Joined:
    Mar 7, 2008
    Messages:
    51
    Likes Received:
    0
    Tell me about it, I tried to set up the Open Toolchain 115 times and not a single one of them works. Leopard 10.5.5 or even 10.5.3 for me was not working, Tiger even failed. So, after many "Trash everything, and try again" sessions, I decided to wait for the Official SDK.

    And to the other people in this thread who helped me with this, THANKYOU x1.0 million. It solved my problem tenfold. Now I just need to work out a big bug in my code where a UITableView is impossible to populate with cells and assign actions to them

    Please Register or Log in to view images

    .

    Thanks again,

    allbrokeup.

    Edit: Reboot isn't working, I found the binary in /sbin/ but I cannot execute it from the app, Hard and Soft ReSpring works like a charm. Is there another Reboot code? What about Power Off instead of Reboot? Thankyou.
  6. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    For rebooting and powering off, you can use the tools in reboot.h.
  7. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    yes, use the following:

    Code:
    #include <sys/reboot.h> 
    /* It may be located differently on the SDK i never checked */
    ..
    ..
    ..
    void reboot() {
            reboot(0);
    }
    
    void shutdown() {
            reboot(RB_HALT);
    }
  8. allbrokeup

    allbrokeup New Member

    Joined:
    Mar 7, 2008
    Messages:
    51
    Likes Received:
    0
    hey guys, thanks for the help but Xcode doesn't let me include that file. (reboot.h) I'm using the 2.1 Sdk by the way, if that helps. If it continues like this, I will simply re engineer the update packages to work with a respring only. Thanks...
  9. allbrokeup

    allbrokeup New Member

    Joined:
    Mar 7, 2008
    Messages:
    51
    Likes Received:
    0
    bump? does anyone know why I cannot include the "reboot.h" in my project?
  10. allbrokeup

    allbrokeup New Member

    Joined:
    Mar 7, 2008
    Messages:
    51
    Likes Received:
    0
    bump bump bumpity no-more-nda bump bump

    Please Register or Log in to view images



    Can somebody please give me a tutorial for (or redirect me to) the Open Toolchain Binary Installer from Saurik, for Cygwin and Mac OS X Leopard?? I really need this, as I accidentally deleted a system folder on my iMac and now I'm stuck using the Boot Camp partition until saturday, I don't wanna re-download them after I erase everything and reinstall. I would really (really x1 million) appreciate this.

    I also would appreciate a tutorial on how to write a Makefile, since I understand it about as much as Gobbledegook.

    Please Register or Log in to view images



    Thankyou

    P.S. I am going to release my Source Code for my iUtility application to people who are willing to help (join forces on Google Code) me develop it.

    Please Register or Log in to view images

    Please Register or Log in to view images



    P.P.S. PM me requests and I will send you the code.

    Please Register or Log in to view images

Share This Page