如何在 App Store (iTunes) 中链接到我的应用程序? [英] How can I link to my app in the App Store (iTunes)?

查看:36
本文介绍了如何在 App Store (iTunes) 中链接到我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的应用程序中有一项功能,用户可以通过该功能向朋友发送电子邮件,其中包含指向我的应用程序的 iTunes URL.怎么可能?

I want to have a feature in my app where the user can send an email to a friend with the iTunes URL to my application. How is it possible?

谢谢.

推荐答案

您可以创建更简单、更合乎逻辑的 App Store 链接,而不是您通常看到的冗长和混乱的 url.iTunes Store 有一种更合乎逻辑的隐藏 URL 格式.根据您要链接到的内容,您只需构建以下格式之一的 URL:

Rather than the long and confusing urls that you usually see, you can create App Store links that are much simpler and more logical. The iTunes Store has a hidden URL format that’s much more logical. Depending on what you’re linking to, you just need to build a URL in one of these formats:

  1. 艺术家姓名或 App Store 开发者姓名:http://itunes.com/Artist_Or_Developer_Name
  2. 专辑名称:http://itunes.com/Artist_Name/Album_Name
  3. 应用:http://itunes.com/app/App_Name
  4. 电影:http://itunes.com/movie/Movie_Title
  5. 电视:http://itunes.com/tv/Show_Title

只需在您创建的电子邮件正文中包含此格式的网址即可.

Just include a url of this format in the body of the email you create.

(请注意,空格可能会导致问题,但我发现省略它们对我完全有用 - http://itunes.com/app/FrootGroove 重定向到名为Froot Groove"的应用.)

(Note that spaces might cause problems, but I found that omitting them entirely worked for me - http://itunes.com/app/FrootGroove redirects to the app called "Froot Groove".)

(另请注意,如果这对您不起作用,iTunes 链接制造商是 这里)

(Also note that if this doesn't work for you, the iTunes link maker is here)

您的代码将是这样的(摘自我的,匿名且未经测试)

Your code will be something like this (extracted from mine, anonymised and not tested)

NSString* body = [NSString stringWithFormat:@"Get my app here - %@.\n",myUrl];

#if __IPHONE_OS_VERSION_MIN_REQUIRED <= __IPHONE_2_2
[NSThread sleepForTimeInterval:1.0];
NSString* crlfBody = [body stringByReplacingOccurrencesOfString:@"\n" withString:@"\r\n"];
NSString* escapedBody = [(NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,  (CFStringRef)crlfBody, NULL,  CFSTR("?=&+"), kCFStringEncodingUTF8) autorelease];

NSString *mailtoPrefix = [@"mailto:xxx@wibble.com?subject=Get my app&body=" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

// Finally, combine to create the fully escaped URL string
NSString *mailtoStr = [mailtoPrefix stringByAppendingString:escapedBody];

// And let the application open the merged URL
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailtoStr]];
#endif

你可以在 iPhone 3.0 中做更好的事情,但我还不能谈论这些.

You can do better things in iPhone 3.0, but I can't talk about those yet.

这篇关于如何在 App Store (iTunes) 中链接到我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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