Decrypting HTTP Streaming Video with NSURLProtocol

Sunday, 8 January, 2012 Posted in:

I want to share what I thought was a clever idea from a member of Apple’s DTS team. I’d been working on an app featuring a custom video player and video delivered via HTTP streaming. The challenge centered on how to elegantly decrypt an encrypted video stream in the app without transmitting the key with the stream. Some examples I Googled talked about serving the video up over a custom protocol and using a subclass of NSURLProtocol and then manually decrypting the stream, and while these worked, it seemed like a lot of unnecessary work. As it turned out subclassing NSURLProtocol was the right place to start but the final solution was so much simpler than the examples I’d seen.

Read the rest of this entry »

Signing Google API URLs in iOS

Monday, 18 April, 2011 Posted in:

Lately I’ve been working with the Google Directions API. The service is free to use, you don’t even need to sign up for an API key. However, if you do, you get to make more requests from the service per day. A lot more! So it certainly behooves you to sign up as a Premier customer if you plan to do more than make light use of the API. The catch is all requests to the API from Premier customers have to be signed with an API key, and this was just a little bit annoying to do for iOS development. So here’s a quick walk through to help out the next guy.

Read the rest of this entry »

Strange iOS App Exit When Testing with the Debugger

Tuesday, 7 September, 2010 Posted in:

Today I was testing a new build of an iOS app and experienced what I think is a weird conflict with a previous version of the app. Here’s what happened:

I was testing a developer build of the app on an iPhone 3G running 3.1.2 and an iPhone 4 running 4.0.1. Before testing I installed an updated developer provisioning profile on each device. Everything worked perfectly on the 3G, but on the iPhone 4 the app would show the splash screen for a split second then close. It was as if the app was crashing on the iPhone 4 but there was no crash information showing up in the debugger. As far as the debugger was concerned there was nothing wrong to report.

I opened the Organizer window and checked the Device Logs tab for any crashes but there was nothing regarding the app I was testing. Next I checked the Console tab and saw the following:

Tue Sep 7 15:59:11 My-iPhone com.apple.launchd[1] (UIKitApplication:com.appname[0x2d1][6531]) : (UIKitApplication:com.appname[0x2d1]) posix_spawn(“/var/mobile/Applications/…/AppName.app/AppName”, …): Permission denied

Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Unable to obtain a task name port right for pid 6531: (os/kern) failure

Tue Sep 7 15:59:11 My-iPhone com.apple.launchd[1] (UIKitApplication:com.appname[0x2d1][6531]) : (UIKitApplication:com.appname[0x2d1]) Exited with exit code: 1

Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Unable to look up event port name for pid 6531: (os/kern) successful

Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Unable to send activation event to com.appname animate activate: safe animationStart = 406459.5189769584 deactivate: : (ipc/send) invalid destination port

Tue Sep 7 15:59:11 My-iPhone SpringBoard[28] : Application ‘AppName’ exited abnormally with exit status 1

I Googled for explanations about the different warnings without success. Not knowing what else to do I decided to test the app one more time from a clean slate, so I deleted both the app and development profile from the iPhone 4. I tested again and to my surprise the app launched and worked flawlessly.

So what happened? An ad hoc build of a previous version of the app was already installed on the iPhone 4 and I did not delete it before testing a new developer build. Maybe Xcode 3.2.3 doesn’t completely remove a previous version of an application when testing a new version, and instead only updates relevant parts of the application’s bundle. If the bundle wasn’t updated correctly I suppose it could explain this weird behavior, though I really would have expected the app to be replaced completely or for an outright crash when i tried to run the app.

Anyway, if you are testing your app and you see similar behavior and an error message like the one above try deleting your app from the phone and then testing. Maybe it will work for you as well.

Developing for iOS and Android

Saturday, 7 August, 2010 Posted in:

I’ve had the opportunity to develop on both the iOS and Android platforms, something that, statistically speaking, makes me part of a minority of developers. My experience has been that the iOS platform offers better tools for developers, but that the Android platform offers more freedom in what a developer can do with a device. I thought I’d share some of my observations on the differences between the two platforms for anyone who is curious what its like developing for the other device.

Read the rest of this entry »

A New and Noteworthy App

Sunday, 25 July, 2010 Posted in:

Last week Apple featured BuzzVoice 3.0 under New and Noteworthy Apps on the iTunes App Store’s front page — a real treat for any app developer. This had a strong effect on app sales and it wasn’t long before BuzzVoice broken into the top charts under the App Store’s News section making it as high as number eight under the Top Paid Apps and number six under Top Grossing.

BuzzVoice in Top Grossing Apps

Very Cool!

A new set of apps is showing up under New and Noteworthy now (I’m told that Apple cycles the category every week). I hope they see the same good fortune as BuzzVoice.

Apple, what were you thinking?

Tuesday, 6 July, 2010 Posted in:

At the end of June Apple sent a notification out to members of its developer program advising them that all new iPhone apps and updates would have to be built with the iPhone SDK 4. The important bit of the email read thus:

Make sure that your applications are compatible with iOS 4. All new applications and updates to existing applications must be built with iPhone SDK 4. In addition, the App Store will no longer support applications that target iOS 2.x.

This seems reasonable and, by itself, is not a problem as apps can still target previous versions of iOS even though they are built with iPhone SDK 4. The problem arises when you realize that any third party libraries your app uses will also have to be recompiled.

Several months ago Apple purchased QuattroWireless as their ad solution and recently relauched it as iAds. Most third party library publisher will be very quick to provide an updated version of their compiled library (if they don’t just provide the source code), and this is where I think Apple dropped the ball. This is not the case with QuattroWireless, at least at the time of this writing. The existing QuattroWireless library can not be used in apps built with SDK 4 without generating compile errors. The library needs to be republished for the updated SDK, however an email exchange with QuattroWireless reveals they have no plans to do this

As you may know, QuattroWireless was bought by Apple. As a result we are moving forward with our iOS 4.0 support in the new iAd platform. There will be no immediate update to the QuattroWireless SDK to support 4.0. We hope you join the iAd Network for 4.0 ads. Please let us know if you have any further questions

So why not just go with iAds? Including iAds in your app means you limit your audience to just people who have upgraded to iOS 4. Including iAds in your app means your app will not run on the iPad (the iPad has no iOS 4 support at this time). Basically implementing iAds means limiting your potential audience, at least for the time being.

I guess this means all the apps that currently use QuattroWireless and who are unwilling to lose audience by updating to SDK 4 will be looking to another ad solution such as AdMob.

Apple, what were you thinking?