开发者

How to open the application on an iPad from a webpage?

开发者 https://www.devze.com 2023-01-28 20:21 出处:网络
We need to start an application on the iPad when the user cl开发者_如何学编程icks on a button in a web page. Please let us know the code snippets for the link to be added in the web page to open the a

We need to start an application on the iPad when the user cl开发者_如何学编程icks on a button in a web page. Please let us know the code snippets for the link to be added in the web page to open the application on the iPad. We are planning to create the web page using the ASP.net technology.


This might be something you're looking for: http://applookup.com/2010/09/iphone-apps-with-special-url-shortcuts/

Updates: the link above is dead. And as cdm9002 suggested, for the love of dogs, here are the information (credits goes to iOS developer tips)

First of all, you need to use method like UIApplication:openURL: to launch an application from a webpage. For example, you can launch Apple Mail in this way:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://info@iphonedevelopertips.com"]];

To launch your own application, there are two things to do: register the custom URL schemes and handle the URL launch in your application.

To register the custom URL schemes, you edit the info.plist. Below the custom scheme 'myapp' is registered.

CFBundleURLTypes 
    CFBundleURLSchemes 
      myapp 
    CFBundleURLName
    com.yourcompany.myapp

Now, you can launch the app with the following URLs.

myapp:// 
myapp://some/path/here 
myapp://?foo=1&bar=2 
myapp://some/path/here?foo=1&bar=2

And in iPhone SDK (I think it applies to iPad as well), when launching the application in response to any of the URLs above, will send a message to the UIApplicationDelegate.

In order to retrieve the information passed in the URL, like /some/path/here, you simply provide an implementation for the message in your delegate.

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url 
{
  // Do something with the url here
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号