Mr Speaker

The elusive Pinterest App Link handler

App Links seem like a perdy good idea: trying to bring back a bit of the web to walled garden-ed applications. Of course, the issue is it's up to the individual app developers to support them. And it seems that the big social sites are quite fond of not making things more open. Also, they like to break stuff that was working before.

The tl;dr is the old Pinterest protocol handler for opening the app was pinit12, now it's pinterestsdk.v1. Previously, to create a pin you'd use pinit12://pin/create/bookmarklet/ now you use pinterestsdk.v1://pinit/. I haven't tested it out completely, because I got really bored of the limitless hell that is "sharing to social networks" - but it opens up the app and looks like it works (I added the info.plist settings from the SDK docs - though they probably shouldn't be necessary).

I found the handler thanks to an error message that popped-up in a stack trace. It eventually lead me to PDKPin.m which contained the following lumps of gold:

static NSString * const kPDKPinterestAppPinItURLString = @"pinterestsdk.v1://pinit/";
NSURL *pinitURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", kPDKPinterestAppPinItURLString, [params _PDK_queryStringValue]]];
    if ([[UIApplication sharedApplication] canOpenURL:pinitURL]) {
        [[UIApplication sharedApplication] openURL:pinitURL];
    } else {
        //open web pinit url
        NSDictionary *webParams = @{@"url": [sourceURL absoluteString],
                                    @"media": [imageURL absoluteString],
                                    @"description": pinDescription};
        NSURL *pinitWebURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", kPDKPinterestWebPinItURLString, [webParams _PDK_queryStringValue]]];
        [[UIApplication sharedApplication] openURL:pinitWebURL];

Hopefully this is useful to fellow tired and weary social-sharing-integration souls wandering the wastelands of terrible SDKs and out-of-date documentation (including, most likely, this blog post). God speed.

Captcha! Please type 'radical' here: *
How did you find this thingo? *