共享链接,将打开我的应用程序或应用程序商店

我已经开始研究一个iPhone应用程序,并决定让用户能够通过networking分享(通过电子邮件,Facebook,Twitter,消息等等)。 现在我想要链接到应用程序(在用户的共享文章上),以便能够检查我的应用程序是否安装在设备上,并通过它的URLscheme打开它,如果不是的话 – 打开导向应用程序的另一个链接在App Store上。

我已经做了一些研究,并理解我应该在我的服务器端或沿着这些线做一个PHP,我怎么也找不到一个教程或一个明确的例子傻瓜(我对PHP / jscript / jquery一无所知)。 ..有人可以帮我一把吗?

- (IBAction)openOtherAppButtonAction { UIApplication *ourApplication = [UIApplication sharedApplication]; NSString *URLEncodedText = [@"AppName" stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *ourPath = [@"openapp://" stringByAppendingString:URLEncodedText]; //openapp is the url custom scheme name. NSURL *ourURL = [NSURL URLWithString:ourPath]; //instead of our path you can directly write @"openapp" if ([ourApplication canOpenURL:ourURL]) [ourApplication openURL:ourURL]; else { //Display error UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Receiver Not Found" message:@"The Receiver App is not installed." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; // OR open link [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.urlForApp.com"]]; } } 

//现在,您要打开哪个应用程序的info.plist

1添加名称—-> URLtypes的新行

2现在在Item 0中添加另一个名为——> URL Schemes的对象

3现在在URL Schemes的项目0处给出您想要打开您的应用程序的名称,例如@“openapp”

4您必须在要打开的应用程序的应用程序代理中编写此代码

 - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { return YES; }