Cocoa Mac Application Title says: “untitled”

I have created a document based Mac OSX application, and when I’m editing in Interface Builder, the title is correct (I filled out that portion of the inspector) but once the program runs, the application title is ‘Untitled’. How can I change it? In my IB Doc Window, I have instances of Files Owner, First Responder, NSApplication, and NSWindow. There is no view controller, is that the issue? I’m new to Cocoa..

  • NSTextView with Smart Quotes disabled, still replaces quotes
  • NSPredicate with functions or selectors
  • UIScrollView contentOffset change after another view pushed
  • Calculating number of seconds between two points in time, in Cocoa, even when system clock has changed mid-way
  • Zooming in and out in WebView Cocoa
  • Why is self.view.subviews an empty array in viewDidLoad?
  • 5 Solutions Collect From Internet About “Cocoa Mac Application Title says: “untitled””

    One solution is to override -displayName in your NSDocument subclass:

    - (NSString *)displayName {
        if (![self fileURL])
            return @"Some custom untitled string";
        return [super displayName];

    You can also check out NSWindowController‘s -windowTitleForDocumentDisplayName: if you’re using custom window controllers.

    you have created a document based Cocoa application. For new documents, Cocoa sets the proposed name of the document to ‘Untitled’.

    Do you mean the application menu title? That is changed to match the name of the application at runtime. The simplest way to change it would be to change the Product Name build setting on your target in Xcode.

    - (NSString *)displayName
        NSMutableString *displayName = [NSMutableString stringWithString:[super displayName]];
        if ([self fileURL] == nil) {
            NSString *firstCharacter = [[displayName substringToIndex:1] lowercaseString];
            [displayName deleteCharactersInRange:NSMakeRange(0, 1)];
            [displayName insertString:firstCharacter atIndex:0];
        return [NSString stringWithString:displayName];

    That’s because you checked Create Document-Based Application when you created this project:

    new project options

    You can remove it from info.plist by clicking the button next to Document types:


    Type in your own title in Storyboard and check the window to “is Inital Controller”. After you run your project again, it will be OK.