0

I tried

[[NSDocumentController sharedDocumentController] duplicateDocumentWithContentsOfURL:nil
                                                                            copying:NO
                                                                        displayName:nil
                                                                              error:NULL] ;

but it is not working. I have the error

typeForContentsOfURL:error: must be overridden for your application to support non-'file:' URLs.
Colas
  • 3,473
  • 4
  • 29
  • 68

2 Answers2

2

Did you try like this below:-

   [[NSDocumentController sharedDocumentController]newDocument:self];
Hussain Shabbir
  • 14,801
  • 5
  • 40
  • 56
0

I don't really know about the NSDocument+NSDocumentController machinery but here is my guess . Since I am answering my own question, please don't hesitate to comment or react.

    [[NSDocumentController sharedDocumentController] addDocument:[[Document alloc] initWithType:nil
                                                                                      error:NULL]] ;
Colas
  • 3,473
  • 4
  • 29
  • 68