Scene Editor Development: Unable to Open Scenes

I ran into a problem where I was unable to open the scenes I created in the editor. When I choose File > Open in the Mac version, the scene file is disabled. The scene file appears to save as the wrong type.

The Document Type and UTIs

The scene editor saves scenes as binary property lists. I used the following identifier for the document type, imported UTI, and exported UTIs:

com.apple.binary-property-list

That identifier is the UTType for binary property lists.

The type conforms to the following UTI:

com.apple.property-list

I set the file extension for the UTIs to .sks.

The Problem

When I saved a scene I got the following error message in Xcode’s console:

Error Domain=NSCocoaErrorDomain Code=256 “The autosaved document “TestScene” could not be reopened. SpriteKit Editor cannot open files in the “property list” format.”

I also noticed the saved scene had the extension .plist instead of .sks.

The Solution

I created a custom identifier for the document type and UTIs. The document type conforms to the binary property list type, com.apple.binary-property-list.

Get the Swift Dev Journal Newsletter

Subscribe and get exclusive articles, a free guide on moving from tutorials to making your first app, notices of sales on books, and anything I decide to add in the future.

    We won't send you spam. Unsubscribe at any time.