Platforms to show: All Mac Windows Linux Cross-Platform
Back to SMAppServiceMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Login Items | MBS MacCF Plugin | 23.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | All |
An app service object that corresponds to the main application as a login item.
Use this SMAppServiceMBS to configure the main app to launch at login.
SMAppServiceMBS.register(byref error as NSErrorMBS) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Login Items | MBS MacCF Plugin | 23.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | All |
The registration process applies to the following rules, depending upon the type of service:
- If the service corresponds to a LoginItem bundle, the helper starts immediately and on subsequent logins. If the helper crashes or exits with a non-zero status, the system relaunches it.
- If the service corresponds to the main application, the application launches on subsequent logins.
- If the service corresponds to a LaunchAgent, the LaunchAgent is immediately bootstrapped and may begin running. In addition LaunchAgents registered with this method bootstrap on each subsequent login.
- If an app needs to register a LaunchAgent for multiple users, you must call the API once per user while that user is running the app.
- If the service corresponds to a LaunchDaemon, the system won’t bootstrap the LaunchDaemon until an admin approves the LaunchDaemon in System Preferences. The system bootstraps LaunchDaemons registered with this method and approved by an admin on each subsequent boot.
If the service is already registered, this method returns kSMErrorAlreadyRegistered.
If the service isn’t approved by the user, this method returns kSMErrorLaunchDeniedByUser.
SMAppServiceMBS.unregister(byref error as NSErrorMBS) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Login Items | MBS MacCF Plugin | 23.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | All |
error: Upon an unsuccessful return, a new NSError object describing the error. Upon successful return, this argument is nil. This argument may be NULL.
Returns true if the service was successfully unregistered; otherwise, false.
This is the opposite operation of register().
If the service corresponds to a LoginItem, LaunchAgent, or LaunchDaemon and the service is currently running it, the system terminates it. If the service corresponds to the main application, it continues running, but becomes unregistered to prevent future launches at login.
If the service is already unregistered, this method returns kSMErrorJobNotFound.
See also:
SMAppServiceMBS.unregister(CompleteHandler as SMAppServiceUnregisterCompletedMBS, tag as variant = nil)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Login Items | MBS MacCF Plugin | 23.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | All |
CompleteHandler: A completion handler to call with the result of the unregistration operation. Upon an unsuccessful return, the handler contains a new NSErrorMBS object describing the error. Upon successful return, this argument is nil.
See also:
The items on this page are in the following plugins: MBS MacCF Plugin.