I have an idea for a macOS app and I asked about its feasibility here. I had some answers but none from an Apple employee. I'm asking about Apple engineers cause I would really like to know if my app be accepted on the Apple Store. So again, how can I get in touch with an Apple engineer? Thank you.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I would like to know if there’s a way to query another app’s object.
For example, in my app, I can write something like this:
NSArray * myWindow = NSApp.windows;
to access all my app windows.
But what if I want to access the windows of another app?
Is there a way to query the classes or objects of another app?
I would like to know if there’s a way to query another app’s object.
For example, in my app, I can write something like this:
NSArray * myWindow = NSApp.windows;
to access all my app windows.
But what if I want to access the windows of another app?
Is there a way to query the classes or objects of another app?
Wanting to test an idea for a visually impaired friend, I would like to reach another application's mainmenu.
I wrote a very short program (Mainmenu) to test the said idea. The applicationDidFinishLaunching method is as simple as this:
(void)applicationDidFinishLaunching:(NSNotification *)aNotification {
		// log this app mainmenu
		for (NSMenuItem *item in [[NSApp mainMenu] itemArray]) { NSLog(@"\t<%@>",[item title]); }
		// setting up method to get notified when an app becoming active
		NSNotificationCenter *allApplicationsNotificationCenter;
		allApplicationsNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
		
		//	Wait for applications to be launched
		[allApplicationsNotificationCenter addObserver:self
						selector:@selector(applicationActivated:)
						name:NSWorkspaceDidActivateApplicationNotification object:nil];
}
The application starts by logging the app's mainmenu and then waits for another app to get activated. Upon launching, I get this output:
Mainmenu
File
Edit
Format
View
Window
Help
In order to print this mainmenu, I use Mainmenu's NSApplication singleton via the NSApp global variable.
The applicationActivated method called is as below:
(void)applicationActivated:(NSNotification *)aNtfctn {
		NSRunningApplication * rnnngApplctn = [[aNtfctn userInfo] valueForKey:NSWorkspaceApplicationKey];
		
		NSLog(@"\t\t%@",[rnnngApplctn localizedName]);
}
Switching to other applications, I get output like this:
Finder
Xcode
Menum
At this point, applicationActivated is following every activated application. The method is receiving an NSRunningApplication object from the followed applications.
I just don't know how to reach the NSApplication singleton of those external applications in order to reach their mainMenu.
I read many classes documentation and technologies (like Accessibility). I'm wondering if my way to another app's mainmenu is through using an URL to open an app bundle associated with the NSRunningApplication object received. If so, I wonder how to get the NSApplication singleton.
In other words, I don't know what to do next. Can you point me in the right direction ?