Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
497 views
in Technique[技术] by (71.8m points)

objective c - SMJobRemove succeeds, but plist and helper tool not deleted

I'm trying to remove a privileged helper tool installed via SMJobBless, I'm getting a positive return value and no errors, yet the files at /Library/PrivilegedTools and /Library/LaunchDaemons are not deleted. Do I have to delete these files myself?

From the documentation I read:

Return Value true if the job was removed successfully, otherwise false.

I'm calling the following to remove the job: result = SMJobRemove(kSMDomainSystemLaunchd, (__bridge CFStringRef)label, _authRef, YES, &errorCF);

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Thanks jatoben, that thread had the answer I was looking for.

As suspected you do have to remove the files yourself or use the following: (Taken from Apple dev forums:)

SMJobRemove is the equivalent of "launchctl remove". That is, it removes the job from launchd but has no effect on the disk at all. Thus the job will get reloaded the next time you start up. To get around that you have to either remove the plist yourself or by fork/exec'ing "launchctl unload -w".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...