0

I'm making a simple plain-text editor in Xcode.

Whenever I try to save a document in specific extensions I'll get this error:

You cannot save this document with extension “.scala” at the end of the name. The required extension is “.(null)”

I get this alert for certain extensions only (.scala, .jade, ...). I have no problem saving a file using most extensions, real or not (.something, .js, .stackoverflow, .html, ...), or without an extension.

This only happens with Untitled Documents. I can with no problem open the problematic extensions (.scala, .jade, ...) and work normally with them.

Any clues as to what might be the issue?

Here are my Document Types, btw:

Document Types

Edit:

Answering Wil Shipley's questions

Does “scala” or “jade” appear anywhere in your project file? If you create a new file in TextEdit and save it with the “.scala” ending, does it throw the same error? If you double-click on a “.scala” file in the Finder, does it open somewhere?

  • Not when I posted this question. I've added some code that extracts the extension of the file being opened and tries to find it in a NSDictionary to know what file the user is working with (for automatic syntax highlighting purposes and other things it might be useful for). Nothing that interferes with saving the document however. When I posted this question I don't think 'scala' or 'jade' were typed anywhere on the project.

  • It doesn't throw the same error, but it won't allow me to save it with that extension right away. Other extensions (I tried '.c', '.jad', '.scal') will save without any dialog popping out. When I try to save with '.jade' or '.scala' this dialog comes out however:

TextEdit Dialog

It's worth noting it also comes out when I try to save as '.html'. '.html' however will pose no hassle on my application.

  • They will open in Sublime Text. It's the only application I have which can open such documents. I guess it's worth noting also that Finder hides the file extension for these types automatically; something that doesn't happen for made-up extensions like '.scal', '.jad', '.stackoverflow', etc.
Kevin Chavez
  • 949
  • 1
  • 11
  • 27
  • 1
    Does “scala” or “jade” appear anywhere in your project file? If you create a new file in TextEdit and save it with the “.scala” ending, does it throw the same error? If you double-click on a “.scala” file in the Finder, does it open somewhere? – Wil Shipley Jan 11 '14 at 10:29
  • Sorry for taking this long to answer your questions! Just did in my edit. – Kevin Chavez Jan 28 '14 at 15:18

1 Answers1

0

My current thought is maybe Sublime Text has declared the UTIs for .scala and .jade strangely, causing your app is tripping trying to save those two. For instance, if Sublime said .scala was supposed to be of type “folder” or something, that might case the issues...I’m just guessing, though.

To test this, trash Sublime Text and make sure it’s fully off your desktop, maybe even log out and log in to flush UTI cache (voodoo!), and try your app again.

(Make sure you can get Sublime Text back again after the experiment is over, of course.)

Wil Shipley
  • 9,343
  • 35
  • 59