2

I'm developing a tweak that when internet is reachable it does something. This is done with Apple's reachability API. The tweak is loaded in SpringBoard. I have a .plist file containing some information in /MyTweaksFolder. I can read it but I can't modify or change it. I'm guessing it has to do with the privileges of SpringBoard.

My question is: How can I grant root access in a SpringBoard tweak?

4

1 回答 1

3

You do not grant privileges to a tweak, you grant them to the process the tweak is loaded into (SpringBoard in your case). But I wouldn't recommend doing that. I remember trying and SpringBoard wasn't working properly.

If you need root privileges you should create a daemon. As I understand, you're hooking SpringBoard methods. So it will be a tweak and a daemon. When you need to do something as root your tweak will send notification to the daemon. You can even get a proper response. For example, CFMessagePort API allows you to do IPC with your daemon pretty easely and even get a response synchronously to simplify the code. It will like you just calling a function.

That's all for a general case. In your case you just need to place your .plist file in a different directory where SpringBoard has write permissions. Good place would some directory in /var/mobile/. Find the one that works and place .plist there.

于 2014-05-23T20:50:11.207 回答