Programming, Hobbies and Opinion

Main menu

Tag Archives: iphone

Post navigation

Update: It looks like this latest version of Pinterest has removed the URL scheme to post directly to the app. I do hope they add it back in with another update.

I’ve been working on a new version of the iOS app, Wedding Dress Look Book by The Knot, and I wanted to add in sharing features for the most popular networks. This a wedding dress browsing and sharing app, it has to be the top three social networks, Facebook, Twitter, and of course, Pinterest. I know that Pinterest doesn’t have a public sharing API yet, but I use there app on my iPhone, and I have a good idea of how it works. For Facebook and Twitter I find out that iOS supports URL Schemes, which allow me to just open an app as I would open Safari. Just change the protocol, http for regular URLs, to the name of the app. I found a site that has a list of all sorts of apps that support this, fb:// for Facebook, twitter:// for the Twitter app etc. Unfortunately they didn’t have Pinterest, but an easy guess of pinterest:// launched the app right away, though I didn’t know of the options, and I still couldn’t find any documentation. I started to think about how the Pin It bookmark works, the URL scheme must be inside that JavaScript file that Pinterest loads onto the site in mobile Safari. After running the file, http://passets-cdn.pinterest.com/js/pinmarklet.js, through a Javascript Beautifier we can see Pinterest developers speak lolcat with plenty of hazSite and hazIOS. That was it!

Pinterest’s URL scheme is pinit12, I’m guessing 12 is a version number. A little more digging around and I came up with a list of working parameters.

URL Scheme: pinit12://pinterest.com/pin/create/bookmarklet/?

media: a direct link to the image or I think an encoded image (base64?)

url: the URL of the source website where the image was found

description: 500 characters max

is_video: self describing

Since this code isn’t officially supported it is subject to change, and thankfully there is a way to future proof your app from having a broken link. You are able to check if a URL can be opened without actually opening it in iOS. The trick then is prepping your URL, seeing if it can be opening, and only then displaying the option to share with Pinterest. Using a UIActionSheet, with ARC enabled, this is what I came up with.

All development was done in Objective-C in the XCode IDE using the Cocos2d for iPhone framework which was very easy to understand and use. Coming from other languages I was in for a big shock when I had to worry about memory management and actually optimize for my iPod Touch development device I picked up. Getting used to finding my way around Mac OS X was fun as well.

I was very nervous that I submitted a Halloween themed game for October on October 5th but thankfully it was approved by the 14th! Only 9 stress filled days of waiting, pretty low will all the horror stories I hear about getting approved.

UPDATE: It’s been over a year since I considered stopping my study of Objective-C and I can gladly say that I made the right choice in continuing to learn Objective-C and native app development. With Adobe’s recent moves discontinuing Mobile and TV Flash development and moving the Flex SDK to ‘an established open source foundation’ it is clear they are no longer interested in investing in the technology and I’m glad I started expanding now instead of waiting for tomorrow. This is one of those rare times in life I’ll get to look back and pat say that I actually made a great choice for my future.

I’ve been a Flash developer for many years now. I was excited about the opportunity to create native apps for the iOS environment when it was first announced but life was too hecktic at the time to start learning Objective-C. A little while later Adobe sources announced that the next version of the Flash IDE, CS5, would be able to export compiled iOS apps! I was thrilled to hear that I could put all my existing ActionScript knowledge into instant use on the iOS devices and I decided again to work on my other projects and learning C# and wait for Adobe to release CS5. Then the 3.3.1 change happened at the same time that Flash CS5 was release, Apple doesn’t want Adobe’s knock off Objective-C apps ported from Flash. I’m at a complete loss, I waited for the dust to settle and it seemed Apple was completely resolved to keep Adobe out of it’s devices.

It was time to learn Objective-C if I was ever going to get into iOS development. I hit the books and started learning all the fun stuff about C and all the strange things I was going to have to work around that I had gotten used to having in ActionScript 3.

Wait what? I thought Apple was this stone pillar of decision, Steve Jobs even had a post Thoughts on Flash ripping it apart and now it’s OK to put Flash apps on their devices essentially? I’m more than a little frustrated by this. On one hand I’ve started to develop a new skill set in developing mobile applications for the iOS devices and on the other I have a long history of ActionScript knowledge I could use to make iOS apps even faster.

I’m already 70% done with my first iOS app since starting out and now I wonder if I even need to continue to nurture my Objective-C learning because I can just recompile my Flash games and push them right to the store.

I was so mad when Apple first made the decision to reject Flash apps, then I accepted it and started learning Objective-C, now I think I’m kind of upset that they backtracked such a short time but still long enough for me to get neck deep in Objective-C books.

I think I have to finish this first game in Objective-C but after that is it worth the work to continue learning that language now that any language can be compiled down to Objective-C and then approved?