Questions tagged [nsapplication]

NSApplication is the central class in Apple's AppKit framework.

The NSApplication class is the central class in Apple's AppKit framework (). It is responsible for starting the main run loop and provides the central framework for your application’s execution.

References:

178 questions
0
votes
1 answer

NSApplication make window front on app switch

When run my app(OSX, macOS SDK 10.15), it shows the main window, as expected. I then CMD-Tab to another app, but when I CMD-Tab back to my app, it won't show the window. The same happens if I click on it in the dock. I've tried various suggestions,…
0
votes
1 answer

Responding to "Hide Others" Mac OS X

I am looking for a notification or callback that is similar to NSWorkspaceDidHideApplicationNotification for when a user chooses "Hide Others" in any running application. I was wondering if anyone knows of an api or has some advice in detecting the…
0
votes
1 answer

NSApp: Hide main window until proper ViewController can be loaded

I have a MacOS app that is a registered custom URL handler. I'm trying to make it show a specific NSViewController if the app is started via the url handler or the regular window and ViewController if no parameters are used. In my AppDelegate.swift…
Cornwell
  • 3,304
  • 7
  • 51
  • 84
0
votes
3 answers

`NSStatusItem` created from `main()` doesn't show up on system status bar

I'm trying to make a simple macOS Cocoa application using NSStatusItem to create a clickable icon on the system status bar. However, when I launch my application, I get this warning and the icon doesn't show up: 2020-03-03 14:43:11.564…
Eric Reed
  • 377
  • 1
  • 6
  • 21
0
votes
1 answer

How to disable all user interaction for NSApplication/NSWindow without blocking the main thread?

I have a Cocoa app that presents a folder structure to the user and allows basic file system operations such as move/copy/rename. I perform all file system access on a background queue and use file coordination via NSFileCoordinator. Let's imagine…
Mark
  • 6,647
  • 1
  • 45
  • 88
0
votes
1 answer

Make one last change to NSDocument before app terminates/window closes?

I have a basic NSDocument-based app. I need to make one last change to the document when: The user closes the document's window The user terminates the app Why? The document window contains an NSTextField. Usually text entered into this text field…
Mark
  • 6,647
  • 1
  • 45
  • 88
0
votes
0 answers

Swift unable to access other application windows

I'm trying to access the windows of running applications through my application. Currently, I am grabbing the data of all running applications, and the kCGWindowNumber mapped to the applications, but I am having trouble getting the window mapped to…
Chris
  • 153
  • 2
  • 15
0
votes
1 answer

osx and objc - running a second run loop for a plugin?

C programmer here. I'm trying to make a plugin to a running OSX app open its own window, accept a button press, close the window and come back to the plugin - not quit the app. I've been able to get a window open using NSApp, and I've even got a…
fyngyrz
  • 2,458
  • 2
  • 36
  • 43
0
votes
0 answers

The application "App.app” can’t be opened

I'm sure I'm skipping over something, somehow, but I might as well ask. I've been creating an application programmatically, and recently I've been doing some cleaning up to make everything nice, however, recently I'm unable to open my app when the…
0
votes
1 answer

MacOS menu in Swift

I am looking to create a menu sidebar in my application which can display and control view controllers besides the menu. Something like the following: I would like to avoid a TableView for the menu, but I'm not totally against it. I've tried using…
Ckacmaster
  • 366
  • 1
  • 10
0
votes
2 answers

Building Mac OS X App instead of console

I have a port of my application, a game, running on Mac OS X. I build with make, and only added a few .mm files to access the necessities from NSApplication, NSWindow and NSOpenGLView. How do I "convert it" into a proper App as opposed to the…
Jonas Byström
  • 25,316
  • 23
  • 100
  • 147
0
votes
0 answers

Command-line Objective-C++ tool has started crashing in [NSApplication sharedApplication]

I have a little CLT for copying and pasting images, written in Objective-C++. Until recently, this program compiled and ran as intended – but only just now, it seems, it has started crashing in the call to [NSApplication sharedApplication]. The…
0
votes
2 answers

NSView cannot grab Ctrl+Tab Keydown event

In my Mac App, I listen to key press events and pass them on to the internal client, depending on modifiers and key code. Currently, I'm facing the problem, that I can't get a hold of the "Ctrl+Tab" event. It seems that the "App" itself tries to…
Steve
  • 174
  • 4
  • 15
0
votes
1 answer

How to create an arrow pointing to my app's icon on the menu bar?

I have a menu bar only application. On the first time the user runs the app I want to create an animated arrow pointing to my app's icon on the menu bar. The first idea I had was to create a NSPopover showing the arrow but that is obtrusive per se…
Duck
  • 34,902
  • 47
  • 248
  • 470
0
votes
1 answer

Helper application cannot be killed and is not launching the main app

I have other questions on SO about making a sandboxed app launch at login, that apparently have no solution: here and here As you know, you have to create a helper application that will launch the main app and die. All tutorials out there say to add…
Duck
  • 34,902
  • 47
  • 248
  • 470