Subclass iOS 5 UIDocument backward compatible?

To support iCloud, it is recommended that you use a subclass of UIDocument . If I define a new subclass, set the target version of the project to 3.0 and test use for iOS 5 before using my new subclass, will the code work on iOS 4 or will the connection in the subclass break backward compatibility?

+4
source share
2 answers

UIKit may be loosely coupled, but the results will be undefined if you try to initialize a subclass of UIDocument or UIDocument . You will need something like:

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

That would make it completely useless for your purposes. Thus, there is no answer to your question, any code with a UIDocument did not run, but you could install conditional checks of such a code. You better find an alternative method for saving data.

+2
source

It will need to be associated with a UIDocument in order to understand what the UIDocument subclass really means. For example, if you have a Bar class that subclasses Foo and Foo has a doBaz method, you can call doBaz on the Bar instance, but if the linker does not know Foo, it does not know that Bar can do Baz.

You may be able to make a weak link. A similar situation arose with the release of iOS 4, since iAds was not available in iOS 3, which was the best on the iPad at that time.

0
source

Source: https://habr.com/ru/post/1379035/


All Articles