Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codesign question #5

Closed
ealeksandrov opened this issue Oct 23, 2017 · 6 comments
Closed

Codesign question #5

ealeksandrov opened this issue Oct 23, 2017 · 6 comments

Comments

@ealeksandrov
Copy link

Thanks for project, it looks very simple but it simply just doesn't work for me.
How can I debug it? After setting LaunchAtLogin.isEnabled = true it resets to false.
App exported, signed with Developer ID and placed in /Applications.

The most unknown part for me - how to codesign helper on export? Do I need to create separate app id and provision profile for it?

I'm exporting with "Developer ID" signing to test it (only main app signed), I haven't pushed it to App Store yet.
Tried exporting "for App Store" - can't even continue without creating provisioning profile for helper app.

@sindresorhus
Copy link
Owner

Look at the logging in Console.app. It should usually log why it was denied.

The helper app is automatically code-signed when building for release: https://github.com/sindresorhus/LaunchAtLogin/blob/c773d4ed5d435542c8d2bdb09166ff3ae146e409/LaunchAtLogin/copy-helper.sh#L12

@ealeksandrov
Copy link
Author

ealeksandrov commented Oct 23, 2017

Thanks for quick response.

The helper app is automatically code-signed when building for release

Right, and I verified that both parent app and helper have signatures.

In Console.app I found couple of errors related to my process, but I don't think they are about LaunchAtLogin. Also they don't appear on subsequent switching of LaunchAtLogin option.

Sandbox: TestApp(5720) deny iokit-open AppleMultitouchDeviceUserClient
Violation:       deny iokit-open AppleMultitouchDeviceUserClient 
MetaData: {"build":"Mac OS X 10.13 (17A405)","action":"deny","target":["AppleMultitouchDeviceUserClient"],"hardware":"Mac","platform_binary":"no","profile":"unknown","process":"TestApp","op":"iokit-open"}
Sandbox: TestApp(5720) deny mach-lookup com.apple.decalog4.incoming
Sandbox Check by:    launchd(1)

Violation:       deny mach-lookup com.apple.decalog4.incoming 
MetaData: {"build":"Mac OS X 10.13 (17A405)","sandbox_checker":"launchd","action":"deny","target":["com.apple.decalog4.incoming"],"hardware":"Mac","platform_binary":"no","profile":"unknown","process":"TestApp","op":"mach-lookup"}

Also nothing interesting in "All messages" filtered by my process.

@sindresorhus
Copy link
Owner

sindresorhus commented Oct 23, 2017

After setting LaunchAtLogin.isEnabled = true it resets to false.

"After" meaning on the next line? (Like below)

LaunchAtLogin.isEnabled = true
print(LaunchAtLogin.isEnabled)
//=> false

I'm exporting with "Developer ID" signing to test it

I'm using it successfully with both a Developer ID signed app and on the App Store.

@sindresorhus
Copy link
Owner

The problem is that either this line fails somehow:

https://github.com/sindresorhus/LaunchAtLogin/blob/c773d4ed5d435542c8d2bdb09166ff3ae146e409/LaunchAtLogin/LaunchAtLogin.swift#L16

But then you should get a message in Console.app or in the Xcode console.

Or there's a problem reading the status:

https://github.com/sindresorhus/LaunchAtLogin/blob/c773d4ed5d435542c8d2bdb09166ff3ae146e409/LaunchAtLogin/LaunchAtLogin.swift#L9-L13

Maybe try to use the above code manually and see whether it's something that stops working there?

@ealeksandrov
Copy link
Author

After reimplementing your code manually - it started saving state, but doesn't actually launch on login.
After again throwing out all code and reimplementing with your framework - it's all working well.
Not sure what was the issue in first attempt or what I missed on second one.

Thanks for great lib and quick support! Sorry for unknown issue, most likely something was wrong with my setup.

@ealeksandrov
Copy link
Author

UPD:
https://stackoverflow.com/questions/27876046/error-when-enabling-auto-login-of-mac-os-app-using-a-helper/36326592

I found my helper in list of "disabled services". Removing is impossible, after enabling helper still doesn't work. But the same app works completely fine on another machine.
Looks like messing with launchd can lead to such issues on development machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants