Gentlemen, I'd be grateful for some advice.
We have got a pretty standard setup of an application with a login item helper launched through SMLoginItemSetEnabled. Works properly when we test it, works properly for a vast majority of our users — but for a very small number of users for whom the helper does not launch at all.
In an attempt to find the culprit, I have added (otherwise unnecessary) LMCopyAllJobDictionaries and in the returned dictionaries am searching for one with a "Label" equal to our bundle ID. The result is logged out.
For the unlucky (very rare, but alas sometimes occurring) user case our logs say it works like this:
- we call SMLoginItemSetEnabled(bundleID, YES), get return value YES;
- we check LMCopyAllJobDictionaries and do get an item with our bundle ID;
- the helper does not run though. We wait a long time (a full minute), but the helper still does not launch;
- then we clean up and retry: we call SMLoginItemSetEnabled(bundleID, NO), get return value YES;
- now we check again LMCopyAllJobDictionaries and this time do not get an item with our bundle ID;
- go to 1.
It seems the helper does not launch-and-crash; looks like it is not launched at all (or at most, it crashes before its first log, which happens in one of the +load methods, i.e., very very soon; also, the user for whom the problem happens never seen the helper in the Activity Monitor).
To be frank, we are out of ideas how to find the culprit. Will be very grateful for any reasonable advice what to do to find (and potentially fix) the issue. Is there e.g., some kind of launchd detailed log which would tell us why precisely the helper is not launched upon SMLoginItemSetEnabled(bundleID, YES)?