spankmaster79
spankmaster79

Reputation: 22193

Use any link in itms-service links for app distribution

I would like to use a different link than a direct link to a .plist file in itms-service links, but it seems iOS doesn't call it.

<a href="itms-services://?action=download-manifest&
url=http://example.com/app.plist">Install App</a>

This works, but if I try to call a script that outputs the .plist, I don't see a request coming in at the webserver.

<a href="itms-services://?action=download-manifest&
url=http://example.com/
checksomething?param=test">Install App</a>

Does anybody know why?

Maybe iOS checks if the link contains a .plist and doesn't call the link if it's not there?


OK, I know now that passing the URL to iOS fails:

if ([[UIApplication sharedApplication]canOpenURL:url]) {
    [[UIApplication sharedApplication]openURL:url];
    return NO;
}

Maybe the NSURL Object needs the parameter separate.

Upvotes: 4

Views: 7498

Answers (2)

colm.anseo
colm.anseo

Reputation: 22027

If you're using PHP 5, urlencode() & http_build_query() can do a lot of the hard work of escaping special characters for you. These functions also avoid issues where some of your GET parameter name/value pairs may have sensitive characters that need to be transmitted safely e.g.

<?php
    $base_url = "http://example.com/checksomething";
    $data = Array("param" => "test", "dangerous" => ":?&= are some sensitive chars");
    $itms_url = "itms-services://?action=download-manifest&url=" . urlencode($base_url . "?" . http_build_query($data));
?>

<a href="<?=$itms_url;?>">Install App</a>

Upvotes: 0

Jim
Jim

Reputation: 73936

The question mark is a reserved character. You need to encode it as %3F. Same goes for the equals sign - it should be %3D.

Upvotes: 11

Related Questions