Find out an app's URL programmatically

◇◆丶佛笑我妖孽 提交于 2019-12-08 03:16:38

问题


I need to launch another app from within my own app, but I don't have its URL. So my question is: Is there a way to find out another app's url programmatically based on its bundle identifier, or trackid?


回答1:


No, there is no way to determine an app's custom URL scheme programmatically. An app's custom scheme, if there even is one, can be completely unrelated to anything else you may know about the app.

The only way to determine the scheme is to access the app's Info.plist file, and unless you are on a jailbroken device, this can't be done at runtime.




回答2:


If you just want to launch other apps, you can use ios private api.

@interface PrivateApi_LSApplicationWorkspace
    - (bool)openApplicationWithBundleID:(id)arg1; //LSApplicationWorkspace
    - (NSArray*)privateURLSchemes; //LSApplicationWorkspace
    - (NSArray*)publicURLSchemes;
@end

PrivateApi_LSApplicationWorkspace* _workspace;
_workspace = [NSClassFromString(@"LSApplicationWorkspace") new];
[_workspace openApplicationWithBundleID:bundleIdentifier];
NSArray* privateUrls = [_workspace privateURLSchemes];
NSArray* publicUrls = [_workspace publicURLSchemes];

check https://github.com/wujianguo/iOSAppsInfo



来源:https://stackoverflow.com/questions/22380530/find-out-an-apps-url-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!