问题
when i put myapp.app in ios5 root's Applications folder, but it can't work. why? but i find that cydia can work normally.
回答1:
- In the main.m add
setuid(0);
andsetgid(0);
- Build the app normally.
- Then copy and paste the executable inside the .app and rename it to anything you want, don't rename the original file.
- Open the original executable file and delete its contents (the contents are now stored in the previously copied and renamed binary).
Add this bash script to the empty binary file from 4. :
#!/bin/bash dir=$(dirname "$0") exec "${dir}"/<COPIED FILE NAME> "$@"
Springboard will run this file first because its the CFBundleExecutable, then this will launch the actual app's executable. This is done because SpringBoard would fail to directly launch the executable with root permissions
- Open terminal and change the directory to the .app (ex.
cd /User/Me/Desktop/MyApp.app
) chmod
the original executable file to 0755 (ex.chmod 0755 MyCFBundleExecutable
) and the copied file to 6755 (ex.chmod 6755 CFBundleExecutableRoot
)- SSH the .app into /Applications on your device, respring and launch it (if its not launching then repeat set 7. but by SSHing into your device via terminal)
来源:https://stackoverflow.com/questions/9749760/install-app-into-jailbroken-ios-root-s-applications-folder