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.
Did you try like this below:-
[[NSDocumentController sharedDocumentController]newDocument:self];