如何使用iPhone自定义URL方案 [英] How to use iPhone Custom URL schemes

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

问题描述

我有一个应用程序,我希望能够使用自定义URL方案。我希望用户能够使用自定义URL协议打开Tweetie,但是我需要使用动态网站链接来填充tweet,该链接使用currentItem.link。



我发现此代码启动了Tweetie并使用静态信息填充消息:

  NSString * abbrev_url = @http://your.url .COM; 
NSString * stringURL = [NSString stringWithFormat:@tweetie://%@,abbrev_url];
NSURL * url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

所以使用上面的代码如何使用currentItem.link信息填充消息?



谢谢。

解决方案

完全取决于接收端的应用程序。你必须了解他们的协议如何工作,那么你可以使用它们所设计的协议。



将http://协议URL添加到tweetie的末尾://协议URL不是正确的方法,并且建议搜索Tweetie URL协议如何工作。


I've got an app that I want to be able to use Custom URL schemes for. I want users to be able to open Tweetie using the Custom URL protocol however I need to populate the tweet with dynamic website link which I get using currentItem.link.

I found this code which launches Tweetie and populates a message with static information:

NSString *shortened_url = @"http://your.url.com";
NSString *stringURL = [NSString stringWithFormat:@"tweetie://%@", shortened_url];
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];

So using the above code how would I populate the message with currentItem.link information?

Thanks.

解决方案

It depends entirely on the application on the receiving end. You have to find out how their protocol works, then you can use their protocol as it is designed.

Adding a http:// protocol URL to the end of a tweetie:// protocol URL is not the correct method, and searching for how the Tweetie URL protocol works would be suggested.

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

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