Developers
Open In
Using URL schemes you can open other apps as long as you know how to structure the URL. In addition, you can open OnSong using the UIDocumentInteractionController when you pass a file type that OnSong can handle.
URL Scheme
You can use an URL on an iOS device to open OnSong and perform import functions. The following URL can be entered into the location bar of Safari to have iOS open the OnSong app.
onsong://
If you want to open OnSong from an iOS app, you can combine the following Objective-C statements to determine if the user has OnSong installed, and if so, open OnSong from within your app.
// See if the user has OnSong installed
if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"onsong://"]]) {
// Open OnSong from your app
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"onsong://"]];
}
If you would like to import a supported file format stored on your website, replace the http:// component of the URL with onsong:// to open OnSong and prompt the user to import the file. If you use SSL, you will need to issue a redirect to the https:// location of the file since OnSong will resolve to the http:// location first.
onsong://my.domain.com/files/go/here/Song%20Title.txt
In some cases you may not have the file available on a web server. For instance, you may want to generate the file within an app and then pass it to OnSong without first saving it to a publicly accessible location. Likewise, you may want to secure the delivery of content since it is only available for authenticated users. For those purposes, OnSong can also import files using a Base64-encoded file using the following syntax such as this:
onsong://ImportData/My%20Song%20Title.pdf?BASE_64_ENCODED_DATA_HERE
As an example, click on the following link to import Welcome To OnSong as a PDF file.
OnSong uses the file extension that is passed to it to determine how to treat each type of file. If you are dynamically generating content, you'll want to send a filename by setting a Content-Disposition HTTP header.