Question

To support iCloud, we're encouraged to use a UIDocument subclass. If I define a new subclass, set the project target version to 3.0, and test using for iOS 5 before using my new subclass, will the code work on iOS 4 or does linking in a subclass break backwards compatibility?

Was it helpful?

Solution

UIKit can be weak-linked, but the results would be undefined if you tried to initialize a UIDocument or UIDocument subclass. You would need something like:

if (NSStringFromClass(@"UIDocument")) 
{
    ...
}

That would make it totally useless for your purposes. So the answer to your question is no, any code involving UIDocument would not run, but you could put conditional checks around such code. You're better off finding an alternative method for saving data.

OTHER TIPS

It will need to link with UIDocument in order to understand what subclassing UIDocument actually means. For example, if you have class Bar which subclasses Foo, and Foo has method 'doBaz', you can call 'doBaz' on a Bar instance, but if the linker doesn't know Foo, it doesn't know Bar can doBaz.

You may be able to do a weak link though. There was a similar situation when iOS 4 came out, with iAds not being available in iOS 3, which was the best on iPad at the time.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top