Embedded app not running

As I mentioned in this thread https://developer.apple.com/forums/thread/695207 I want my containing app to be active after Mac restarts.

I thought about something that could work - I wrote a "helper" embedded app which will be added to the login items, and after a restart this "helper" app will open the containing app. However, after archiving the project (with developer ID, it will be distributed outside the App Store), I see the following error at the Console:

Non-fatal error enumerating at , continuing: Error Domain=NSCocoaErrorDomain Code=260 "The file “PlugIns” couldn’t be opened because there is no such file." UserInfo={NSURL=PlugIns/ -- file:///Applications/MyMainApp.app/Contents/Library/LoginItems/LauncherApplication.app/Contents/, NSFilePath=/Applications/MyMainApp.app/Contents/Library/LoginItems/LauncherApplication.app/Contents/PlugIns, NSUnderlyingError=0x7fc5cb02c6f0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

I see that there's really no plugin folder, but why? Is it a certificate/signing issue?

Answered by Systems Engineer in 695927022

The questions: Why I can't see it at the Login Items?The really important question: Even that the app is now at the foreground after Mac restarts, It's not really active - applicationDidFinishLaunching() is not getting called, so I can't listen to notifications from the extension. Any way to make it work?

It sounds like the container app is failing to launch properly and the launching process is not being recognized by the OS as a valid app associated with your project. If you use a helper app or a daemon here it may not be correctly recognized as part of you project and therefore it does not shown up in Security and Privacy properly. Check the following:

  1. That your helper app or daemon bundle id is super set of your container app's bundle id.
  2. Check that this helper app or daemon is placed in the correct location inside the bundle as described here.
  3. Check the code signature on the this helper app / daemon.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Edit: I'm using the same Developer ID certificate as my main app, but for the embedded app I'm not using any provisioning profile (I set it to 'None'), is it ok?

Accepted Answer

The questions: Why I can't see it at the Login Items?The really important question: Even that the app is now at the foreground after Mac restarts, It's not really active - applicationDidFinishLaunching() is not getting called, so I can't listen to notifications from the extension. Any way to make it work?

It sounds like the container app is failing to launch properly and the launching process is not being recognized by the OS as a valid app associated with your project. If you use a helper app or a daemon here it may not be correctly recognized as part of you project and therefore it does not shown up in Security and Privacy properly. Check the following:

  1. That your helper app or daemon bundle id is super set of your container app's bundle id.
  2. Check that this helper app or daemon is placed in the correct location inside the bundle as described here.
  3. Check the code signature on the this helper app / daemon.
Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

I just changed the bundle id of the helper app, to be the same as the containing app's bundle id + a postfix. So if the containing app bundle id is com.mycompany.myapp, the bundle id of the helper app would be com.mycompany.myapp.helper Is this is what you meant by superset? Anyway, after this change I still don't see any Login Item (not in Users & Groups, and not in Security and Privacy), but, the app is now active after a Mac restart, so it's already a big improvement.

Update: I just read that login items installed via Service Management framework won't appear at the system preferences, so no problem on this area.

So if the containing app bundle id is com.mycompany.myapp, the bundle id of the helper app would be com.mycompany.myapp.helper Is this is what you meant by superset?

Yes, that is what I meant.

Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com

Check that this helper app or daemon is placed in the correct location inside the bundle as described here.

That link doesn't mention daemons, though. If an app has something that is intended to run at boot time, I had assumed a launchd plist would be installed by the app into /Library/LaunchDaemons -- is /Applications/AppName.app/Contents/Library/LaunchDaemons intended instead?

If an app has something that is intended to run at boot time, I had assumed a launchd plist would be installed by the app

I’ve addressed this in your other thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Embedded app not running
 
 
Q