How to locate and launch other apps within an app on Mac - macos

I'm new here and also new to Mac Programming.
I want to launch an app or get its url within another app.
However,I don't know how to implementing this program without monitoring the processes.
The problems are:
1.An app can be installed every where.
2.A process can be a system service.
If the question isn't clear enough, please get me noticed.

Related

How can one run many copies of a MacOS App

I was thinking of this today and was wondering what is it on MacOS app that prevent me from running, for example, 5 instances of a specific app?
I was thinking it could be the bundle_id (similar to iOS) but when I copied and renamed the app (to appname_2) edited the bundle_id (to bundle_id_2) for that specific app it didn't launch and instead just put that application in the foreground.
Maybe there's a method that checks the Mac address of the device and only allows one app to run per Mac address.
Due to it being hard to find and info on this online, wondering if it's possible to run multiple versions of an app on my Mac.
I'm pretty sure a virtual machine would work but if I wanted to run 100 instances of that specific app then id run all out of ram and would render my Mac useless for actual work.
The LaunchServices (Finder, NSWorkspace APIs, etc.) on MacOS allow you run one app per user session. Nothing prevents you from launching an app a second time when you don't use Launch Services. (And your assumption is correct that LaunchServices looks at the BundleID to see if the app is already running).
e.g. when you open two Terminal windows and start Mail via (/Applications/Mail.app/Contents/MacOS/Mail) in both you have two Mail instances. open /Applications/Mail.app/ won't work two times because it'll use LaunchServices.

Run .sh on mac remotely from server

Not sure how clear the title is, but basically I've created a program for Windows which my company can use to build games remotely from their desktops. Currently the Windows aspect works without a hitch, but I'm struggling to get our Mac to build.
We use psexec for the Windows side, and I tried to use it for Mac as well (just hoping), to be stuck with an Invalid Handle error.
The way the program works is the user selects from their system tray what they want to build, we have two options that require the Mac, both of those currently are the only ones that don't work.
We do have the ability to remotely access the Mac as well, but we're looking to mostly automate the process so that literally anyone (even the non-technically savvy) can click two buttons and create a build.

How to distribute an update for an nw.js app

With the forthcoming demise of Chrome Web Store Apps, I have successfully transitioned my app to nw.js I was amazed at how easy it was and how it ran first time. About the only tricky thing I encountered was how to get my app icon showing on mac.
However I am somewhat worried about app updates. Does anyone know what happens to persistent data (indexed-DB etc) when a user updates a nw.js app with a new version that I publish to my web site for download?
Also if anyone can help me with how to achieve automatic updates. I mean the full works here. What code is needed to check for an update, what code do I need to write to deliver the update, what code is needed to install the update. Chrome did all of this for me and I know absolutely nothing about server side coding.
For mac there is a mac store support:
http://docs.nwjs.io/en/latest/For%20Users/Advanced/Support%20for%20Mac%20App%20Store/
IndexedDb, localstorage, etc. will persists until the app name will not change.
For automatic updates:
There is an ongoing pull request going on for auto updater.
https://github.com/nwjs/nw.js/pull/5722
Till then, the easiest way for auto update Your application code is to host your app code on the web and open the web page with nw.js.
If You want to autoupdate the nw.js itself then you will have to provide an installer for that and tell the user to download and run the installer if there is a new update.
The documentation (http://docs.nwjs.io/en/latest/For%20Users/Advanced/Autoupdates/#autoupdates) recommends node-webkit-updater and nwjs-autoupdater. Wherein node-webkit-updater the oldest solution, which is not maintained anymore. It's also has flaws (e.g. unpack via unsigned unzip and system specific apps)
As for the second one (nwjs-autoupdater), I personally do not like the idea to install golang just to have my NWJS app autoupdate...
As an alternative one can consider https://github.com/dsheiko/nw-autoupdater
It provides an API (like node-webkit-updater, but cleaner with use of async/await) to customize auto-update flow in one's app including download/install progress

Detecting and launching an external application from within a Windows Phone 7.1/7.5 application

I need to write an application that can detect if the "Bing - Get me there" application is installed on the current phone and if so, launch it.
Is this possible? The app would need to do this for other external applications as well, so a generic method or interface for this would be helpful.
Applications run in a sandbox on Windows Phone and there is no way to tell if other applications are installed unless you are writing both of them and you use a method to announce to other applications that you are installed and they know how to read that announcement.
2 approaches to such announcements would be:
Have both (all) apps synchronise with a web server and report which devices they have been installed on. The apps can the query which other apps have been installed on that device.
Have all apps write a file to a location where all apps can access. The only place to do this is the PicturesLibrary so you have to embed the identifier in the name of the image or in its contents and be able to query all images to identify the other installed apps. The user could manually delete any images you create in this way though.
Beware, neither method can tell if the other app has subsequently been uninstalled though so this is far from foolproof.
As far as I know, there's no way to do that.
Applications on Windows Phone run in complete isolation, and can not act with other applications, other than some highly specialized apps (i.e. for playing media).

Mac app crashes from finder but runs inside Terminal

I tried searching, but did not find a specific post that could answer my question.
For my MacOS app, I have an external framework residing in /Library/Frameworks that I am linking to.
The app runs fine from Xcode. The app runs fine by itself on my dev system.
If I copy the app bundle over to another machine, and also copy over the external framework to /Library/Frameworks area (so it has a similar setup to my dev machine), the app crashes when it tries to perform the task that uses the external framework.
What's weird is that the app does not crash on the other machine if run from the terminal, or through gdb. It only crashes on the feature using the external framework when launched from the Finder. I made sure permissions etc are all open.
The crash is of BAD_ACCESS (SIGSEGV) type and the feature involves using the framework to write out a file.
Any thoughts about what could be causing the crash/how to go about debugging this?
Thanks
The most likely difference you're running into is working directories -- launching an application manually from the terminal will run it in whatever directory you happen to be in at the time, while launching it normally (e.g, by double-clicking it in the Finder) will start it up with a working directory of /. Make sure you aren't using any relative paths by mistake.

Resources