用途:媳妇在某app上卖货,做的还行,多店铺需要后台保活消息推送
环境:iOS 15未越狱 + trollStore 签名安装测试
遇到问题:播放静音频保活效果不理想,想尝试更理想的方案
解决过程:查看论坛帖子,发现关键词"BKSProcessAssertion" 于是hook,并查阅资料,不管是创建使用BKSProcessAssertion还是直接hook更改参数还原都返回非法 Client is missing required entitlement
是没有root权限导致无法使用BKSProcessAssertion,还是食用方法不对,小白一条,碰到刚需实属无奈来论坛请教
- (instancetype)initWithPID:(NSInteger)pid flags:(NSUInteger)flags reason:(NSUInteger)reason name:(NSString *)name withHandler:(id)handler
{
// 打印参数信息
NSLog(@"Hooked initWithPID:flags:reason:name:withHandler:");
NSLog(@"PID: %ld, Flags: %lu, Reason: %lu, Name: %@", (long)pid, (unsigned long)flags, (unsigned long)reason, name);
// 调用原始方法
return %orig(pid, 0xf, 7, name, nil);
}
报错简报
Nov 16 23:13:22 Mokle-xsm Runner(Mokle.dylib)[12270] : Hooked initWithPIDreason:name:withHandler:
Nov 16 23:13:22 Mokle-xsm Runner(Mokle.dylib)[12270] : PID: 12270, Flags: 3, Reason: 7, Name: YourForegroundAssertion
Nov 16 23:13:22 Mokle-xsm runningboardd(RunningBoard)[34] : Acquiring assertion targeting [application<com.taobao.fleamarket2>:12270] from originator [application<com.taobao.fleamarket2>:12270] with description <RBSAssertionDescriptor| “YourForegroundAssertion” ID:34-12270-44818 target:12270 attributes:[
<RBSLegacyAttribute| requestedReason:BackgroundUI reason:BackgroundUI flags:( PreventTaskSuspend PreventTaskThrottleDown )>,
<RBSAcquisitionCompletionAttribute| policy:AfterValidation>
]>
Nov 16 23:13:22 Mokle-xsm Runner(RunningBoardServices)[12270] : Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 “Client is missing required entitlement” UserInfo={RBSAssertionAttribute=<RBSLegacyAttribute| requestedReason:BackgroundUI reason:BackgroundUI flags:( PreventTaskSuspend PreventTaskThrottleDown )>, NSLocalizedFailureReason=Client is missing required entitlement}>