要运行示例项目,请运行pod try SecurityKit
CocoaPods是 Cocoa 项目的依赖管理器。您可以使用以下命令安装它:
[hidecontent type="logged" desc="隐藏内容:登录后可查看"]
$ gem install cocoapods
要使用 CocoaPods 将 SecurityKit 集成到您的 Xcode 项目中,请在您的Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'
use_frameworks!
target '<Your Target Name>' do
pod 'SecurityKit'
end
然后,运行以下命令:
$ pod install
pod 'SecurityKit'
import SecurityKit
if SecurityKit.isDeviceJailBroken() {
// Do Something
}else{
// Do Something
}
import SecurityKit
if SecurityKit.isDeviceSimulator() {
// Do Something
}else{
// Do Something
}
import SecurityKit
if SecurityKit.isRevereseEngineeringToolsExecuted() {
// Do Something
}else{
// Do Something
}
import SecurityKit
if SecurityKit.isVPNConnected() {
// Do Something
}else{
// Do Something
}
import SecurityKit
override func viewDidLoad() {
super.viewDidLoad()
ScreenCaptureProtection.shared.makeProtection(for: self.view)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(false)
ScreenCaptureProtection.shared.removeScreenProtection(for: self.view)
}
import SecurityKit
var window: UIWindow?
func sceneWillResignActive(_ scene: UIScene) {
// Called when the scene will move from an active state to an inactive state.
// This may occur due to temporary interruptions (ex. an incoming phone call).
guard let image = UIImage(named: "Placeholder") else {return}
SecurityKit.createSecureScreenShot(window: window, image: image)
}
func sceneDidBecomeActive(_ scene: UIScene) {
// Called when the scene has moved from an inactive state to an active state.
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
SecurityKit.removeSecureScreenShot(window: &window)
}
import SecurityKit
// String Encryption
let encrypt = SecurityKit.StringEncryption(plainText: "plainText", encryptionKey: "key")
// String Decryption
let decrypt = SecurityKit.StringDecryption(cypherText: encrypt, decryptionKey: key)
[/hidecontent]