- 静默安装APP,卸载,打开,监听。
- 进程间通信。
- 获取设备UDID。
- 后台保活。
- 直接使用
pod 'KPAppMananger', :git => 'https://github.com/LZRight123/KPAppMananger.git'
- clone到本地
git clone https://github.com/LZRight123/KPAppMananger.git
pod 'KPAppMananger', :path => '../KPAppMananger'
- 获取设备UDID
[KPAppTool UDID]
// 获取设备信息,包括UDID 本机名称 机身颜色 等
[KPAppTool deviceInfo]
- 后台保活
Signing & Capabilities -> BackgroundModes ->
Audio
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[KPBackgroundTaskUtils sharedInstance] playNoVoliceBackgroundTask];
return YES;
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
[[KPBackgroundTaskUtils sharedInstance] applicationDidEnterBackgroundTask:application];
}
- 操作app
/// 安装本地
[KPAppTool installAppWithIpaPath:self.ipaPath appIdentfier:nil block:^(NSString *installDesc, NSString *completionDesc) {
//...
}];
/// url
[KPAppTool installAppWithRemoteURL:@"your ipa url" downloadProgress:nil completion:nil];
/// 卸载
[KPAppTool uninstallApplication:nil options:nil];
/// 打开
[KPAppTool openApplicationWithBundleID:nil];
- IPC通知
/// 服务端:ping
[KPAppToolInstance pingTimeSecond:3];
[KPAppToolInstance registerIPCNotfication:@"kp.test.pong" callBack:^(NSString *name) {
//....
}];
/// 客户端
[KPAppToolInstance recevicePingCallBack:^(NSString *name) {
NSLog(@"接收到了ping: %@", name);
[KPAppToolInstance postIPCNoftication:@"kp.test.pong"];
}];
- 进程间收发消息
[KPLocalConnect registerLisenerAtPort:5555 callBack:^NSDictionary * _Nonnull(NSString * _Nonnull path, NSDictionary * _Nonnull query) {
if ([path isEqualToString:@"/xxxpath"]) {
return @{
@"path": path?:@"",
@"quey": query?:@{},
};
}
return @{
@"msg": @"path is error",
};
}];
/// 客户端
[KPLocalConnect getAtPort:5555 path:@"xxxpath" parameters:@{@"key1": @"value"} completion:^(NSDictionary * _Nonnull response, NSError * _Nonnull error, NSURLSessionDataTask * _Nonnull task) {
NSLog(@"response: %@", response);;
}];