简体   繁体   English

Cycript脚本可在后台运行应用程序

[英]Cycript script to run app in background

I have a cycript backboardd script that works great on iOS 7 for modifying an app to continue running in the background. 我有一个cycript backboardd脚本,在iOS 7上非常cycript ,可以修改应用程序以使其在后台继续运行。

app = [BKProcess processForPid:$PID];
alive = [[BKProcessAssertion alloc] initWithReason:7 identifier:"AppKeepAlive"];
[alive setFlags:0xF];
[sc addAssertion:alive];

This is all that's needed. 这就是所需要的。 However on iOS 8 this does't work as BKProcess is now BKSProcess and BKProcessAssertion is now BKSProcessAssertion and they have different methods. 但是在iOS 8这不起作用,因为BKProcess现在是BKSProcessBKProcessAssertion现在是BKSProcessAssertion ,它们具有不同的方法。 There doesn't seem to be a way to attach the assertion to the app like on iOS 7 . 似乎没有像iOS 7那样将断言附加到应用程序的方法。

Can some please help me get this working under iOS 8 . 可以帮我在iOS 8下工作吗?

There is, however when I used this I simply used the initializer with the required PID . 但是,当我使用它时,我只是使用带有所需PID的初始化程序。

- (id)initWithPID:flags:reason:name:withHandler:

Check out the BKSProcessAssertion header for reference. BKSProcessAssertion标头以供参考。

If you want to see an implementation for reference, check out MessageBox (now deprecated, but for reference): 如果要查看实现以供参考,请签出MessageBox (现已弃用,但仅供参考):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM