Detecting programmatically whether an app is installed on iPhone

后端 未结 4 1389
予麋鹿
予麋鹿 2020-11-27 04:40

I am in this situation where I have to display a button which says \"Open myApp\" (if myApp is installed on the device) or it says \"Download myApp\" (if myApp is not instal

4条回答
  •  执念已碎
    2020-11-27 05:20

    If the URL scheme for your app is "myapp:", then

    BOOL myAppInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"myapp:"]];
    

    (Requires iOS 3.0.)

提交回复
热议问题