NSKeyedArchiver/NSKeyedUnarchiver compatibility on different iOS versions
In an iOS app, we are using serialization of complex objects through NSKeyedArchiver/NSKeyedUnarchiver to store info and data.
So the app will include such a serialized object in the app bundle, and this file will be created under one specific iOS version (let's say iOS 5.0)
As the app will be running on different iOS versions (> 5.0) and even in future versions to come, we want to be sure that the original serialized object included in the app bundle will be perfectly readable on every other iOS (6.1, 7.0, ...)
Assuming that the complex object to serialize is composed of objects whose classes are included in the SDKs of all these iOS versions (for sake of simplicity let's assume no deprecation will occur in the future on these classes), can we be completely sure that it will always be compatible with all the iOSs?
To be absolutely 100% sure you would need to use all custom objects and then you have full control over the archive / unarchive process. But, so long as all the classes are appropriately using the encode and decode methods of the keyed archiver then everything will be future compatible.
If Apple ever did decide to break this for some reason, you best option is to catch the resulting exception and inform the user that they will need to obtain an upgrade to the app.
Your alternate approach is to store the initial deployment of data in a different format (like JSON, maybe compressed) then at app startup if you have an existing version, use it, if not, read in the initial deployment data.