Can I use UIDocument in a Mac OSX app?

I would like to share a common document format between iOS and OSX. Note that this is not an MDI application; there will ever be one document to save/load. NSDocument style user driven management (e.g.. Save, Save As, Open etc.) is not required.

The biggest challenge is there seems to be no common document encoding format naturally compatible with OSX and IOS (yet). According to Document-Based Application Programming Guide for iOS, it looks like encoding/decoding conversion is required between NSDocument and UIDocument derived classes. I wish there is a universal serialization mechanism compatible with all devices across Apple ecosystem. Any thoughts, ideas, tips are appreciated in this regard.

Can I use a UIDocument derived class in my mac osx application and the document becomes compatible with IOS?


No, you can't use or subclass UIDocument in a Cocoa application because UIDocument doesn't exist in Cocoa.

In both NSDocument and UIDocument, you determine the format that you will use. So, just implement them both to use the same format for the output and the input.

It wouldn't be too hard to use the preprocessor to set up a file-pair that implements a subclass of NSDocument when building for the Mac and UIDocument when building for iOS. This would prevent you from having mismatched serialization and deserialization implementations, since you'd have only one copy of each and be using it on both platforms.

Need Your Help

Not able to create table and columns in SQLite Database

android mysql database sqlite table

I Created Database for my application and produced code for table creation. It produce the error as follows. Help me asap! Thank you!

How to sort List made of Lists in C#?

c# .net sorting in-place

I have a class that looks like this: