1

I'm creating the document with:

[NSDocumentController openDocumentWithContentsOfURL:display:completionHandler:] 

When I'm working with the instance of NSDocument and sometimes I'm getting crashes because document.fileURL == nil. What cases in NSDocument lifecycle can cause this?

Sanich
  • 1,739
  • 6
  • 25
  • 43
  • I can't find `makeDocumentWithContentsOfURL:alternateContents:ofType:completionHandler:` in the documentation. What does parameter `alternateContents` do? What is the return value? – Willeke Feb 24 '19 at 13:55
  • @Willeke Sorry, I used `openDocumentWithContentsOfURL:display:completionHandler:`. Edited the question. – Sanich Feb 24 '19 at 14:01
  • Is the document created from a file or are you using a web or any other URL? – Sulthan Feb 24 '19 at 14:40

1 Answers1

1

document.fileURL is nil until you save the document for the first time.

Dirk
  • 2,335
  • 24
  • 36