LSOpenURLSpec error - objective-c

I have created a minimal OS X boot stick (basically the Snow Leopard DVD with all the packages and installer stripped out). I've written a basic Cocoa app launcher to launch other apps that I put in the Applications folder (the minimal install lacks Dock and Finder).
When I try to launch an app I get this error:
LSOpenFromURLSpec() returned -10810 for application (null) path /Applications/MyApp.app
Where "MyApp.app" is the app I tried to launch. I've tried this with both NSWorkspace's openFile method and the UNIX "open" utility and I get more or less the same error. One way that launching an app works is if I just execute the main executable of the app itself. (e.g. /Applications/MyApp.app/Contents/MacOS/MyApp). However this method is kind of inconvenient as it stalls the launcher until the app I launched exits. Any alternate ways to launch an app (or fix the LSOpenFromURL error)?
Thanks

Found a workaround:
/Applications/MyApp.app/Contents/MacOS/MyApp >/dev/null 2>/dev/null &
Using that command starts apps without stalling the launcher.

open relies on Launch Services, which relies on the Finder. Your script workaround starts a new background process executing the application's code with its standard out and standard error open to /dev/null. That should work fine.
The C equivalent under Mac OS X would be to either posix_spawn or fork/vfork then exec the executable file.

Related

How can I run an embedded binary in my OSX application?

I have an application which needs to run an external program.
I have included this program as an Embedded Framework. When archived, it appears at the location %AppRoot%/Contents/Frameworks/MyExternalApplication.
How can I run this program from my app's code without using an absolute path? I'd like to run in both release and debug.
Thank You!
You can run the executable by using an NSTask object or the posix_spawn() function.
You can use the NSBundle class to find the absolute path of the executable. See this article for details.
Notes:
That is not the correct place within the app bundle to place the executable; I believe it should be in Contents/MacOS, as documented here.
If the main app is sandboxed (a requirement if you want to put the app on the Mac App Store) then an entitlement is required that will be embedded into the external executable so that it inherits the app's sandbox. See this question for details.
Once you've done 2. you will notice that the executable will no longer run from the command line, but that's nothing to worry about, as it will run from within your app.

FinderSync appex not installed

I have an application that implements a FinderSync app extension. The problem is that on a customer computer, it seems that FinderSync is installed only after Finder is restarted, but not before. The customer has osx El Capitan(10.11.2).
I have a screenshot from that customer with the application running, but finder extension not installed in System Preferences->Extensions
I also have a log file where I logged the output of the following command:
pluginkit -m -A -i com.xxx.xxx.xxx -v
which returns
(no matches)
The thing is that this happens only on that machine, all other machines we are testing on are working fine: the extension is loaded immediately after the application is opened.
Do you know why Finder does not load the appex immediately after application is running?
Is there a way to avoid this behavior?
Thanks!
You got to look in the System.log file for plugin com.xxx.xxx.xxx invalidated.
If you see that, it means that the system has kicked out your plugin. You can just re-add then.
I'm currently looking into why mine get's invalidated.

LUA windows: How do I launch windows metro app with Unified Remote script

I'm trying to make a custom remote for unified remote server in windows 8.1
The sample scripts have os.start(command). It works for something like calc, but I'm trying to launch a metro app 'netflix://' and Lua doesn't seem to want to accept it - I think it's not taking the front slashes.
Is there a way to get Lua to launch a metro app in windows? Thanks
Assuming you mean os.execute() command, to run commands that open files and run based on protocol association, you need to use start command:
os.execute("start http://google.com")
If you need to put the parameter in quotes, then make sure to include a pair of empty quotes as the first parameter:
os.execute([[start "" "netflix://..."]])
For os.start(), it seems that you have to pass the whole path to a command. The Unified Remote API states that it should match installed applications, but I believe it might only be applicable to applications with binaries in the PATH, which is why their example of calc works.
With this in mind, and knowing that start works well directly from PoweShell, this command does what we need:
os.start("C:\\WINDOWS\\system32\\cmd.exe", "/c", "start", "netflix:");
Answering this old question since it's the top google hit when looking for launching windows10 apps with Lua for Unified Remote
As a side note, due to limitations on the Netflix Win10 app, I ended up simply opening Firefox and giving it the Netflix URL. Assuming default installation:
os.start("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "https://www.netflix.com");

Emulate CMD in Metro Style App For Win 8 on ARM

As we know , we are not going to have a command line prompt as we in traditional Windows system for Windows on ARM.
I am trying to emulate command line prompt. The Question i have is it possible for us to spawn new process/app from a given app (as a background task could also do) with parent app having all information about child app?
You CAN dynamically load and execute assemblies.
Assembly.Load() works fine - as long as the target is a System assembly or in your app's package graph (i.e. in your app's package, or a declared 's package).
You're right, Metro/Desktop are very different. A 'MetroCMD.exe' would by definition be restricted; given the isolated nature of Metro apps, would a Metro CMD.EXE be useful?

How to distribute a self developed mac application?

I've developed an application on XCode, compiled and built it.
If I run the app on the same machine using Finder, it starts normally.
But if I copy the app to another machine and try to run it, the application does not start.
Is there another step that I forgot after building the application on XCode?
I think it seems to be a simple issue, but I really need some help on it...
Thanks!
On a machine where it doesn't start, open the Console utility, try launching your program, and see if any new messages appear in the Console window.
OK, It was a very stupid error...
I was sending the app to the other machine through iChat. When the download completes the execute permission of the executable file inside the app is automatically removed.
So, I was trying to execute a non executable app.
Thanks everybody!