Check if iphone installs an app "Go"

Source: Internet
Author: User

Transfer from http://blog.csdn.net/zengconggen/article/details/7714514#

Development encountered a problem: when the company's multiple products, you want to be in a product a can directly open another product B. If the user has not installed product B, open the App Store download page. For this problem: there are 3 technical points:1, and whether product B has been installed for testing. 2, in-app technology to open other apps: reference: https://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/ advancedapptricks/advancedapptricks.html#//APPLE_REF/DOC/UID/TP40007072-CH7-SW18

3, the technology to jump from app to app download page: reference: http://blog.csdn.net/zengconggen/article/details/6789420for the 2nd and 3 points, this article will not speak. The 1th technical point scheme is now available: (Note: The technology is risky and may cause the app to be rejected.) But the App Store has a similar online work. See RP) Solution 1: (Proven: This scheme is IOS5 invalid, simulator can)//DeclarationBOOL apcheckifappinstalled (NSString *bundleidentifier);//Bundle identifier (eg. com.apple.mobilesafari) used to track apps//ImplementationBOOL apcheckifappinstalled (nsstring*bundleidentifier) { StaticNSString *ConstCachefilename =@"com.apple.mobile.installation.plist"; NSString*relativecachepath = [[@"Library"stringByAppendingPathComponent:@"Caches"] Stringbyappendingpathcomponent:cachefilename]; Nsdictionary*cachedict =Nil; NSString*path =Nil; //Loop through all possible paths the cache could is in for( Shorti =0;1; i++) { Switch(i) { Case 0://jailbroken apps would find the cache here; their home directory Is/var/mobilePath =[Nshomedirectory () Stringbyappendingpathcomponent:relativecachepath]; Break; Case 1://App Store Apps and Simulator'll find the cache here, Home (/var/mobile/) is 2 directories above sandbox folder Path = [[Nshomedirectory () stringByAppendingPathComponent:@".. /.."] Stringbyappendingpathcomponent:relativecachepath]; Break; Case 2://If The app is anywhere else, default to hardcoded/var/mobile/Path = [@"/var/mobile"Stringbyappendingpathcomponent:relativecachepath]; Break; default://Cache not found (loop not broken) returnNO; Break; } BOOL Isdir=NO; if([[Nsfilemanager Defaultmanager] fileexistsatpath:path isdirectory: &isdir] &&!isdir)//ensure that file existsCachedict =[Nsdictionary Dictionarywithcontentsoffile:path]; if(cachedict)//If Cache is loaded and then break the loop. If the loop is not "broken," it'll return NO later (default:case) Break; } nsdictionary*system = [Cachedict objectforkey:@"System"];//First Check all system (jailbroken) Apps if([System Objectforkey:bundleidentifier])returnYES; Nsdictionary*user = [Cachedict objectforkey:@"User"];//Then all the user (App store/var/mobile/applications) Apps if([user Objectforkey:bundleidentifier])returnYES; //If Nothing returned YES already, we'll return NO now returnNO; } Solution 2: Reference: http://blog.csdn.net/zengconggen/article/details/7714466There are limitations to this scenario: only apps that have been recently run by the user can be obtained. For apps that have been installed but are not running recently. Not applicable. BOOL Isexsit= [[UIApplication sharedapplication] Canopenurl:[nsurl urlwithstring:@"Rumtel://com.rumtel.audiomanager"]]; NSLog (@"App%@ installed", identifier); if(isexsit) {[[UIApplication sharedapplication] Openurl:[nsurl urlwithstring:@"Rumtel://com.rumtel.audiomanager?a=1&b=2#sect"]]; } Else { //Open the App Store download pageScenario 3 needs to know the open address of B. Available. The final solution is identified as 3: the current public app-related information: http://Wiki.akosma.com/iphone_url_schemes

Check if iphone installs an app "Go"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.