获取设备上的所有 iOS url 方案
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25672362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
get all iOS url schemes on device
提问by PruitIgoe
Is there a way to get all the url schemes of all the apps on a device? There has to be a central repository of them somewhere, maybe a plist?
有没有办法获取设备上所有应用程序的所有 url 方案?必须在某个地方有一个它们的中央存储库,也许是一个 plist?
回答by Greg Barbosa
Adding my solution in case someone is still looking. After spending some time researching the answer, I finished off on a mix between @danielbeard's and @Avis' solution.
添加我的解决方案以防有人仍在寻找。在花了一些时间研究答案之后,我完成了@danielbeard's 和@Avis' 解决方案的混合。
Because I know what application I am looking for:
因为我知道我在寻找什么应用程序:
- Download the .ipa from iTunes using my computer
- Copy the application to my desktop
- Rename it to *.zip
- Extract the *.zip
- Open the 'Payload' folder
- Right click on the application and select 'Show Package Contents'
- I then double-click the 'Info.plist' file (which Xcode should then open)
- Then check 'URL types' > 'Item 0' > 'URL Schemes'
- 使用我的电脑从 iTunes 下载 .ipa
- 将应用程序复制到我的桌面
- 将其重命名为 *.zip
- 解压 *.zip
- 打开“有效载荷”文件夹
- 右键单击应用程序并选择“显示包内容”
- 然后我双击“Info.plist”文件(然后 Xcode 应该打开)
- 然后检查“URL 类型”>“Item 0”>“URL Schemes”
Using that information I then add it to an array of apps to check (doing what @danielbeard suggested).
然后我使用这些信息将它添加到一系列应用程序中进行检查(按照@danielbeard 的建议进行操作)。
Hope this helps someone in the future.
希望这对未来的人有所帮助。
回答by Avis
if it's programatically, i don't know.
如果以编程方式,我不知道。
here is answer to related to your question(not exactly)
这是与您的问题相关的答案(不完全是)
Find out an app's URL programmatically
But manually, on your device-
但是手动,在您的设备上-
yes...
是的...
there is a way to get url schemes of all apps on your device by this procedure. Install ifunbox on your system. Connect your device, open user applications and open the app that you are trying to find url scheme. you will find app home folder, in that folder you will find info.plist of that app. open info.plist and check url scheme address in the last column.
有一种方法可以通过此过程获取设备上所有应用程序的 url 方案。在您的系统上安装 ifunbox。连接您的设备,打开用户应用程序并打开您尝试查找 url 方案的应用程序。您会找到应用程序主文件夹,在该文件夹中您会找到该应用程序的 info.plist。打开 info.plist 并检查最后一列中的 url 方案地址。
it worked for me. you will find url scheme of some apps which are registered for url schemes.
它对我有用。您会找到一些注册为 url 方案的应用程序的 url 方案。
here are some some links for url scheme addresses of some apps.(might save your time).
这是一些应用程序的 url 方案地址的一些链接。(可能会节省您的时间)。
1.http://handleopenurl.com/2.http://wiki.akosma.com/IPhone_URL_Schemes
1. http://handleopenurl.com/2. http://wiki.akosma.com/IPhone_URL_Schemes
回答by justin
Yes, you can use private api. First
是的,您可以使用私有 api。第一的
@interface PrivateApi_LSApplicationWorkspace
- (NSArray*)privateURLSchemes;
- (NSArray*)publicURLSchemes;
@end
then use it:
然后使用它:
PrivateApi_LSApplicationWorkspace* _workspace;
_workspace = [NSClassFromString(@"LSApplicationWorkspace") new];
- (NSArray*)privateURLSchemes
{
return [_workspace privateURLSchemes];
}
- (NSArray*)publicURLSchemes
{
return [_workspace publicURLSchemes];
}
回答by JustAnotherCoder
I'm going to go out on a whim here and assume you are trying to do the following:
我将在这里突发奇想,假设您正在尝试执行以下操作:
- You have a PDF in your app.
- You want to check (programmatically) to see if any other app can open PDF files.
- If so, open PDF using that app.
- 您的应用中有 PDF。
- 您想检查(以编程方式)以查看是否有任何其他应用程序可以打开 PDF 文件。
- 如果是这样,请使用该应用程序打开 PDF。
If you want to do this, you don't have to do step 2 manually. As a matter of fact, you can't. However, you can use the UIDocumentInteractionControllerclass to present a menu of compatible apps.
如果要执行此操作,则不必手动执行第 2 步。事实上,你不能。但是,您可以使用UIDocumentInteractionController类来显示兼容应用程序的菜单。
This is the only way you can "check" for other apps installed on the phone. At least on iOS 7 and under.
这是您可以“检查”手机上安装的其他应用程序的唯一方法。至少在 iOS 7 及更低版本上。
回答by Dmitry Sadakov
It's not supported officially by Apple API without jailbreaking
没有越狱,Apple API 不正式支持它
A workaround might be how Bump knows which apps are launched and support URL Schemes: http://danielamitay.com/blog/2011/2/16/how-to-detect-installed-ios-apps
一种解决方法可能是 Bump 如何知道启动了哪些应用程序并支持 URL Schemes:http: //danielamitay.com/blog/2011/2/16/how-to-detect-installed-ios-apps