Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:

Objective-C
SBAppSliderController* switcherController = MSHookIvar<SBAppSliderController*>(self, "_switcherController");

//or
Objective-C
SBUIController *sharedUI = [objc_getClass("SBUIController") sharedInstance];


Objective-C
SBAppSliderController * switcherController = [sharedUI _appSliderController]; 
//tried this:
SBAppSliderController * switcherController = [sharedUI _switcherController]; 
//and 
SBAppSliderController * switcherController = MSHookIvar<SBAppSliderController *>(sharedUI, "_switcherController");


To quit all apps I need to call _quitAppAtIndex with all application index available
Objective-C
[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
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900