Feeds

Behind the scenes with Apple's media browser

Integrated advantage

Beginner's guide to SSL certificates

Mac Secrets Welcome my second “peek behind the scenes” for Cocoa developers. I enjoyed the responses to the first installment, both for and against, and especially the lively email exchanges, some of which I plan to pick up on in the near future!

For now, though, let me just emphasize a couple of important points.

First, this column is not for novice Cocoa developers. If you're new to Cocoa programming, then you definitely shouldn't be casually exploiting undocumented features of the platform. Instead, go check out some of the great Cocoa tutorials here.

Next, when working with undocumented classes and methods, be sure to bulletproof your code as much as possible. As one of my respondents said: “It's important to have your code fail gracefully if a wanted class/method doesn't exist, rather than... uhh... disgracefully!”

To put this in concrete terms, before calling an undocumented method, use the respondsToSelector: message to see if the method exists. Similarly, when checking for the presence of an undocumented class, use NSClassFromString to get a reference to the wanted class. If the returned reference is nil, then you know the class no longer exists.

You won't find these checks in my sample project because I don't want to obfuscate the basic intent of the code and we all have our own ideas about how error handling should work.

Things get slick

Having got the compulsory caveats out of the way, let's take a look at how to implement the so called "media browser" feature inside your own application. As the name suggests, a media browser is designed to let the end user browse for media - meaning things like photos, movies and audio files - before selecting a wanted item and incorporating it into their document.

Karelia Browser

Browse before selecting your media

At time of writing, a number of open-source media browser implementations exist. For example, type "iMediaBrowser" into Google, and you'll be pointed at various different projects. Heck, you can even buy a commercial implementation. The most popular browser, however, is totally free, includes full source code and it's available here. Once you've downloaded the code and looked through it, you'll see that it's quite a complex beast, using an extensible architecture to handle various different media types.

Protecting users from Firesheep and other Sidejacking attacks with SSL

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
'People have forgotten just how late the first iPhone arrived ...'
Plus: 'Google's IDEALISM is an injudicious justification for inappropriate biz practices'
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
Storage capacity and performance optimization at Mizuno USA
Mizuno USA turn to Tegile storage technology to solve both their SAN and backup issues.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
The next step in data security
With recent increased privacy concerns and computers becoming more powerful, the chance of hackers being able to crack smaller-sized RSA keys increases.