我如何链接到我的应用程序在App

我如何链接到我的应用程序在App

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

问题描述

我想在我的应用程序功能,用户可以发送电子邮件给朋友的iTunes网址我的应用程序。这怎么可能?

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?

感谢。

推荐答案

而不是漫长和混乱的网址,你通常会看到,你可以创建更简单,更合乎逻辑的应用程序商店的链接。 iTunes在线商店有一个隐藏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. 专辑名称:

  3. 应用程序:

  4. 电影:

  5. 电视:

  1. Artist’s name or App Store developer’s name: http://itunes.com/Artist_Or_Developer_Name
  2. Album name: http://itunes.com/Artist_Name/Album_Name
  3. Apps: http://itunes.com/app/App_Name
  4. Movies: http://itunes.com/movie/Movie_Title
  5. TV: http://itunes.com/tv/Show_Title

只是包含这个格式创建的电子邮件的正文中的URL。

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

(注意空格可能导致问题,但是我发现他们忽略完全为我工作 - 重定向到被称为Froot沟的应用程序。)

(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的链接制造商是here)

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

您code会是这样的(从矿中提取,匿名和未测试)

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:[email protected]?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的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 07:28