The referenced documentation code (©2009) appears to be a wee bit outdated...
Try supplying your own NSString for the auto save name, as [window
representedFilename] no longer seems to return a valid
NSWindowFrameAutosaveName.
In AppDelegate.m I have this and it works:
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
[self.window setFrameAutosaveName:@"NSWindowFrameAutosaveName"];
}
-Carl
> On May 22, 2020, at 2:22 PM, Gabriel Zachmann via Cocoa-dev
> <[email protected]> wrote:
>
> I am trying to follow these instructions:
>
> https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/WinPanel/Tasks/SavingWindowPosition.html
>
> However, my app doesn't have a NSWindowController.
> It just has a NSViewController and an AppDelegate.
>
> So i thought I could stick the two lines of code mentioned in the doc in one
> of the app delegate's methods.
>
> I tried to put them in applicationDidFinishLaunching, but they don't have an
> effect.
> I tried to define -awakeFromNib in the app delegate and put them there,
> but awakeFromNib never gets called.
>
> I defined -windowDidLoad in the app delegate, but that, too, never gets
> called.
> (However, other methods like windowWillClose or windowDidEndLiveResize do get
> called.)
>
> Any hints how to achieve the goal will be appreciated.
>
> Best regards, Gabriel
>
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>
> This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]