Q:

Adapt a new Apple Framework class to a previous iOS SDK

I'm using a new API class, NSJSONSerialization, especially the following method :
+ (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error

I'd like to stick as much as I can to the tools Apple is giving us, but this class is only available on iOS 5. 
Is there a way to re-implement the class and its method for iOS 4 so it can call an external JSON framework (JSONKit) by using the exact same call methods ? 
id result = [NSJSONSerialization JSONObjectWithData:myData options:0 error:nil];

If I create a class with the same name (NSJSONSerialization) it will not compile (duplicate interface). 
I can't create a category either, because it will simply ignore any NSJSONSerialization related calls due to its unavailability on iOS 4. 
Any help ? 

A:

IMO you should create your on JSON class and inside it check if NSJSONSerialization is present and use it otherwise fallback to JSONKit. 
Check this AFNetworking implementation to get the idea

