Yosemite and NSApplication.

Use sharedApplication instead of NSApp.