Hello,
I'm developing tweaks for jailbroken iphone, iOS 7, and I have a problem that I can't solve for a while,
is it possible to close all apps running in the background directly from Springboard without opening the background switcher panel?
All the tweaks and source codes I've seen, like Purge, Slide2Kill working from the app switcher panel using self for the controller.
I've tried the following ways:
SBAppSliderController* switcherController = MSHookIvar<SBAppSliderController*>(self, "_switcherController");
//or
SBUIController *sharedUI = [objc_getClass("SBUIController") sharedInstance];
SBAppSliderController * switcherController = [sharedUI _appSliderController];
SBAppSliderController * switcherController = [sharedUI _switcherController];
SBAppSliderController * switcherController = MSHookIvar<SBAppSliderController *>(sharedUI, "_switcherController");
To quit all apps I need to call _quitAppAtIndex with all application index available
[switcherController _quitAppAtIndex:appIndex];
%hook SBAppSliderController
- (void)_quitAppAtIndex:(unsigned int)arg1
{
%log;
if (arg1 == 0) {
for (NSString *appID in [self applicationList]) {
if (![appID isEqualToString:@"com.apple.springboard"])
[self _quitAppAtIndex:[[self applicationList] indexOfObject:appID]];
}
}
else
%orig;
}
Every time I call the function I get the next error, even if I want to close only one app, and I call it with specific index:
<warning>: -[<sbappslidercontroller: 0x12668a390="" xmlns:sbappslidercontroller="#unknown"> _quitAppAtIndex:1]
<error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM removeObjectForKey:]: key cannot be nil'
What I'm doing wrong? any help would be appreciated