如何使用Xcode 4注册自定义应用程序开放URL方案? [英] How to register a custom app opening URL scheme with Xcode 4?

查看:201
本文介绍了如何使用Xcode 4注册自定义应用程序开放URL方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Xcode4要求大量的参数只是为了让这件事变得简单:

Xcode4 is asking for a huge number of arguments just to make this simple thing possible:

NSString *stringURL = @"twitterriffic://";
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

所有这些属性是什么?为什么是图像?我必须在这里重复应用标识符吗?如果我希望任何人能够调用此URL来打开我的应用程序,可以选择什么角色?什么是这些额外的url类型属性?

What are all these properties for? Why an image? Must I repeat the app identifier here? What role to choose if I want anyone to be able to call this URL to open my app? And what are these Additional url type properties for?

我没有找到与Xcode4相关的教程如何使用Xcode 4注册这样的URL方案。

I found no Xcode4-related tutorial how to register such an URL scheme with Xcode 4.

推荐答案


  • 打开左侧的支持文件(文件夹),然后单击YourAppName-Info.plist

  • 选择Bundle creator OS Type Code之类的行并将鼠标悬停在行上并单击(+)符号

  • 这会创建一个新行并输入URL types

  • 单击左边的arror并查看项目0,然后将项目0中的值重命名为URL Schemes,如图所示

  • 然后编辑第0项中的字段并输入原始协议;我输入goomzee如图所示

  • Open "Supporting Files" (folder) on left and click the "YourAppName-Info.plist"
  • Choose a row like "Bundle creator OS Type Code" and mouse over row and click the (+) symbol
  • This creates a new row and type "URL types"
  • Click the arror to left and see Item 0 and you'll rename the value in Item 0 to "URL Schemes" as shown
  • Then edit the field in Item 0 and type in your prototocol; I typed in "goomzee" as shown

现在,如果我在我的模拟器上安装此应用程序,并打开Safari并输入goomzee:/ /在地址栏中它将启动我的应用程序。

Now if I install this app on my simulator, and open Safari and type "goomzee://" in the address bar it will launch my app.

这篇关于如何使用Xcode 4注册自定义应用程序开放URL方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆