如何通过点击“Lite”应用程序中的按钮在iPhone的AppStore中打开“付费”应用页面?

时间:2011-01-25 13:09:31

标签: iphone objective-c iphone-sdk-3.0 ios4

我有2个版本的应用。精简和付费。 我希望在Lite版本中有一个按钮,当点击它时在iPhone上打开App Store应用程序并显示该应用程序的付费版本的页面。

我该怎么做? 我不想在Safari中打开付费版iTunes页面。它应该只在App Store应用程序中打开。

谢谢!

1 个答案:

答案 0 :(得分:4)

这应该始终有效(所有操作系统):

http://itunes.apple.com/app/idYOUR_PAID_APP_ID

代码段(您只需复制并粘贴):

#define YOUR_PAID_APP_ID 553834731 // replace with your paid app ID

static NSString *const iOSAppStoreURLFormat = @"http://itunes.apple.com/app/id%d"; // General link to the App Store

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat: iOSAppStoreURLFormat,YOUR_PAID_APP_ID ]]]; // Would open the right link