網(wǎng)上有很多文章介紹了通過私有API方法判斷是否安裝的方式张肾。在iOS7,8咨察,9诊县,10 通過LSApplicationWorkspac得到安裝應(yīng)用列表的方式得到所有應(yīng)用的bundleID
代碼如下?
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject* workspace = [LSApplicationWorkspace_class performSelector:@selector(defaultWorkspace)];
NSArray*allApplications = [workspace performSelector:@selector(allApplications)];
for(NSString*appStrinallApplications)
?{
NSString*app = [NSStringstringWithFormat:@"%@",appStr];
NSRangerange = [app rangeOfString:@"你要查詢App的bundle ID"];
if(range.length >1)?
{????NSLog(@"已安裝");?
?}
}
iOS11?通過私有類 MCMAppContainer 的方式,判斷bundID是否安裝
代碼如下 :
NSBundle*container = [NSBundlebundleWithPath:@"/System/Library/PrivateFrameworks/MobileContainerManager.framework"];
if([container load])?
{??Class appContainer =NSClassFromString(@"MCMAppContainer");
Bool test = [appContainer performSelector:@selector(containerWithIdentifier:error:) withObject:bundleId withObject:nil];
if(test)?
{returnYES;?}
else{returnNO;??}
?}
?到了iOS12检号,以上方式由于權(quán)限問題也被禁了。那有什么其他的方法可以進(jìn)行判斷么蛙酪?iOS12 只能通過特殊的方法獲取是否安裝 齐苛。目前能做到90%大廠的APP和游戲能檢測成功。個(gè)別應(yīng)用還是無法檢測到桂塞。