NSApp should be declared as NSApplication* or at least marked as deprecated

Originator:kusterer
Number:rdar://19783115 Date Originated:10-Feb-2015 07:13 PM
Status:Open Resolved:
Product:OS X SDK Product Version:Mac OS X 10.10.2 (14C109)
Classification:Serious Bug Reproducible:Always
 
Summary:
NSApp is declared as type 'id'. This invites lots of hilarious bugs and avoids lots of clever warnings the compiler could make about these mistakes.

Examples:
Auto-completion in Xcode suggests the NSSavePanel method beginSheetModalForWindow:completionHandler: or NSWindow's similar method being suggested for NSApp, whereas the NSApplication method is called beginSheet:modalForWindow:modalDelegate:didEndSelector:

The wrong -delegate method is resolved, giving spurious and unnecessary errors about my app delegate not conforming to NSFileManagerDelegate.

Notes:
I hear this bug already exists in your system from someone else as rdar://problem/19782811

All of these issues and distractions could easily be fixed by just declaring it as an NSApplication*.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!