iOS开发:如何缩短代码中的URL? [英] iOS Development: How can I shorten a URL from my code?

查看:119
本文介绍了iOS开发:如何缩短代码中的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个iPhone应用程序,我希望包含允许用户登录Twitter并发布指向我的应用程序的链接的功能。但是,为了做到这一点,推文将需要缩短App Store上我的应用程序的URL。如何编写代码来缩短推文的URL?

I'm building an iPhone app and I'd like to include functionality that allows users to login to twitter and tweet a link to my app. In order to do this, however, the tweet will need to shorten the URL to my app on the App Store. How can I write code to shorten a URL for a tweet?

我已经对此进行了搜索并找到了关于iCodeBlog的教程,以及一些发布在SO上的问题,然而,他们要么比我想象的更多的工作,要么他们正在使用 http://api.tr.im ,已不再可用。我希望有一个更新的方法就像iCodeBlog解决方案一样简单。

I've done a search for this and found a tutorial on iCodeBlog, as well as some questions posted on SO, however, they're all either more work than I think is needed or they're using http://api.tr.im, which is no longer available. I'm hoping there's a newer approach to this that is as simple as the iCodeBlog solution.

感谢您的智慧!

推荐答案

我只是谷歌几分钟,因为我也对这个话题感兴趣。我发现了这个: TinyURL API 我认为这是最简单的实施方式这样的事情。我想我会为此写一个小课程,以便在进一步的项目中使用它。 :-D

I just google a few minutes because I'm also interested in that topic. And I found this: TinyURL API I think that's the easiest way to implement something like this. I think I'll write a little class for this to use it in further projects. :-D

这篇关于iOS开发:如何缩短代码中的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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