How to call SMLoginItemSetEnabled in Mac Catalyst project ?
Our application needs to run automatically at Macos system login. We developed the MacOS app using Mac Catalyst. Normally, MAC projects do this by calling SMLoginItemSetEnabled, but SMLoginItemSetEnabled cannot be called in the MAC Catalyst project.
In the <ServiceManagement/ServiceManagement.h> are defined as follows:
#if !TARGET_OS_IPHONE #include <Security/Authorization.h> #include <ServiceManagement/SMLoginItem.h> #else // !TARGET_OS_IPHONE
The macro “TARGET_OS_IPHONE” is 1 in Mac Catalyst project.
Does anyone know how to resove this problem? Thank you!