ios或mac程序中添加链接到评价页面的方法

Dissecting iTunes, App Store and Mac App Store links

For the latest release of Consume, we wanted to include two buttons: one that linked to all our apps on the App Store, and another that let users easily write a review on iTunes.

These both seem like common things iOS developers would want to do, so we decided to share the results of our research. Some of the information contained below is obvious for experienced iTunes users, while other links are rarer.

Copying links from iTunes

Most links can be copied directly from iTunes. Simply right click (Mac & PC) or control-click (Mac) on a button or linked text in iTunes and select Copy Link.

http://itunes.apple.com/genre/mobile-software-applications/id36?mt=8 — App Store home
http://itunes.apple.com/genre/mobile-software-applications/id6014?mt=8 — Games
http://itunes.apple.com/genre/mobile-software-applications/id6002?mt=8 — Utilities
http://itunes.apple.com/app/consume-mobile-isp-packages/id337064413?mt=8 — An app

These links all function as you’d expect on a Mac, PC, iPad, iPhone and iPod.

iTunes Link Maker

Apple provide a great tool for creating iTunes links, aptly named iTunes Link Maker. It lets you create all kinds of URLs, including a direct link to an artist.

http://itunes.apple.com/au/artist/the-chemical-brothers/id3726283

On Mac or Windows, this link will open your web browser (if you're not already in it), then open iTunes and the artist’s page (The Chemical Brothers, in this case). On an iOS device, the link opens iTunes and loads the artist’s page. iTunes Link Maker tool also lets you create a link to a developer’s apps.

http://itunes.apple.com/us/artist/bjango/id290155421?uo=6

The link functions as expected on iTunes for Mac and Windows, opening up the developer’s page. Unfortunately, it doesn’t work on iOS devices—it opens the iTunes app then gives an error. This is probably because the App Store app doesn’t actually have a page that lists all apps by a developer.

There is a way around the problem though.

Searching and linking with iTunes.com

iTunes.com URLs provide a great method for jumping to search results or directly to an item. If the search produces multiple results, you’ll land on a search results page. If the search produces a single result, then you’ll be taken directly to the item.

http://itunes.com/search — Search for search

This searches for songs, movies, TV shows, artists, developers or any item on the iTunes Store. If the name of the item you’re linking to contains spaces or punctuation, you’ll need to strip them out. You might have issues using this method to link to a single item for common names, as they’ll yield multiple results (try a search for “Dreams” or “Party” if you don’t believe me).

http://itunes.com/artist/song — Link to song by artist
http://itunes.com/artist/album — Link to album by artist
http://itunes.com/movie/moviename — Search for moviename
http://itunes.com/tv/tvshow — Search for tvshow
http://itunes.com/apps/app — Link to app
http://itunes.com/apps/developer/app — Link to app by developer

Using specific URLs is more likely to produce one result, ending up where you intended.

http://itunes.com/apps/developer — Search for all apps by developer

It’s also possible to link to all apps by one developer, but there’s a catch. On a Mac or a PC, this will open iTunes and land on a developer’s page. On an iOS device it’ll do a bit of a dance, opening MobileSafari, then iTunes, then the App Store app. Not ideal, a bit ugly and slow, but it gets there in the end.

If you’d like to hide the redirections and speed up the process, Apple recommend using NSURLConnection.

Mac App Store updates

To open the Mac App Store app and select the Updates tab, use the URL below.

macappstore://showUpdatesPage

Heading straight to a review form

It’s also possible to send someone straight to the review form for an app.

https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/addUserReview?id=337064413&type=Purple+Software

Simply replace the ID with your app’s ID to create a URL for your app.

On a desktop or laptop, this will take you directly to the review form in iTunes for the app or item. On an iOS device, this will open MobileSafari, then open iTunes or the App Store app on the reviews page, leaving the user only one tap away from writing a review.

Update: iOS 4.2 seems to have fixed this and links now open the App Store app directly.

To find out an item’s ID, right (Mac & PC) or control-click (Mac) on a link to the item in iTunes and select Copy Link. The result will look something like this.

http://itunes.apple.com/au/album/dig-your-own-hole/id19605549
http://itunes.apple.com/au/app/consume-mobile-isp-packages/id337064413?mt=8

The ID is the number in the URL after “id’.

It might be worth noting that this URL was created using iTunes 8. I don't think there’s a way to create review links in iTunes 9, so maybe this URL is being phased out. Use with caution.

Update: @mareMtl has provided an alternative review link for apps. Please note that it only works on iOS devices.

itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=337064413

Linking to a specific promo code

To create a direct link to open iTunes and redeem a promo code, replace the “RWAPJ7XLTHN7” portion of the URL below with your promo code.

https://phobos.apple.com/WebObjects/MZFinance.woa/wa/freeProductCodeWizard?code=RWAPJ7XLTHN7

Hat tip to Scott Meinzer for working this one out.

Final results

And the winners are...

http://itunes.com/apps/bjango — Search for all our apps

https://userpub.itunes.apple.com/WebObjects/MZUserPublishing.woa/wa/addUserReview?id=337064413&type=Purple+Software — Go to Consume’s review form

Due to some of the redirecting that takes place on an iOS, using URL shorteners can break links. So, be sure to check before using them on Twitter or Facebook.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值