iOS6 代码实现安装ipa
1
2
|
#import "dlfcn.h" typedefint (*MobileInstallationInstall)(NSString *path, NSDictionary *dict, void *na, NSString *path2_equal_path_maybe_no_use); |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
- ( int )IPAInstall:(NSString *)path { void *lib = dlopen( "/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation" , RTLD_LAZY); if (lib) { MobileInstallationInstall pMobileInstallationInstall = (MobileInstallationInstall)dlsym(lib, "MobileInstallationInstall" ); if (pMobileInstallationInstall){ int ret = pMobileInstallationInstall(path, [NSDictionarydictionaryWithObject:@ "User" forKey:@ "ApplicationType" ], nil, path); dlclose(lib); return ret; } } return - 1 ; } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<? 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.private.mobileinstall.allowedSPI</ key > < array > < string >Install</ string > < string >Browse</ string > < string >Uninstall</ string > < string >Archive</ string > < string >RemoveArchive</ string > </ array > </ dict > </ plist > |
1
|
ldid -Sentitlements.xml InstallApp.app /InstallApp |
1
|
ldid -e InstallApp.app /InstallApp |