Skip to content

Instantly share code, notes, and snippets.

@olxios
Last active May 27, 2021 15:01
Show Gist options
  • Save olxios/20eba76dcdf1b3542d1303e36bc20ad9 to your computer and use it in GitHub Desktop.
Save olxios/20eba76dcdf1b3542d1303e36bc20ad9 to your computer and use it in GitHub Desktop.
[Private iOS API] Kill another application programmatically: http://swiftiostutorials.com/jailbreak-development-kill-another-application-programmatically/
/* You can find private iOS frameworks bundled with Xcode: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/PrivateFrameworks/
In Xcode 7.3 beta private frameworks have been removed from the Xcode bundle. As a workaround you'd have to load the framework at runtime
You can find the generated BackBoardServices header here: https://raw.githubusercontent.com/Cykey/ios-reversed-headers/master/BackBoardServices/BackBoardServices.h
*/
#import <BackBoardServices/BackBoardServices.h>
@implementation AppBackgroundUtil
+ (void)killOtherApp
{
BKSTerminateApplicationForReasonAndReportWithDescription((__bridge CFStringRef)@"com.yourcompany.example", 5, 0, NULL);
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.multitasking.termination</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment