Launch Guitar Pro through my iPhone app
I have an app that finds some guitar tabs and sets them up in a user friendly way. Things work, except for guitar pro tabs. (this is all from ultimate-guitar.com). When the user chooses a guitar pro tab, the webview that follows loads leads to a button page:
http://tabs.ultimate-guitar.com/d/david_gilmour/raise_my_rent_guitar_pro.htm
In my app, if I click that button, nothing happens. However, if I open the Guitar Pro app, click add, and go to ultimate-guitar, search the same song, and navigate to that same page I linked, the application asks if it would like to open that file开发者_如何学Go, and does so successfully.
I would like to leverage the guitar pro app to my users if they have it installed and have the clicking of that button launch the guitar pro app, or any other solution where this could work would be fine. I don't know if there's some sort of notification system I can use, where the Guitar Pro app says that it can handle some certain files maybe and then I tell it that I have one, or what, but any help would be great.
If you open the Guitar Pro bundle, you should be able to discern whether the app is registered to respond to any custom URL schemes or file types. The information will be found in the Info.plist or equivalent file. For example, Good Reader is registered to open PDFs, so when you get a PDF attachment in Mail.app, it gives you the option to open it in that app. And with the URLs, the YouTube and Maps apps are able to open. The key you're looking for in the plist file is CFBundleURLTypes
Apple has a section about communicating with the custom URLs in their Standard Behaviors document. A related excerpt:
To communicate with an application using a custom URL, create an NSURL object with some properly formatted content and pass that object to the openURL: method of the shared UIApplication object. The openURL: method launches the application that registered to receive URLs of that type and passes it the URL. At that point, control passes to the new application.
The following code fragment illustrates how one application can request the services of another application (“todolist” in this example is a hypothetical custom scheme registered by an application):
NSURL *myURL = [NSURL URLWithString:@"todolist://www.acme.com?Quarterly%20Report#200806231300"];
[[UIApplication sharedApplication] openURL:myURL];
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/StandardBehaviors/StandardBehaviors.html
I'm not sure if I got you 100% right, but did you look at Implementing Custom URL Schemes
? This allows you to register a custom url scheme, which, when called, fires up you app.
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/StandardBehaviors/StandardBehaviors.html
精彩评论