We wrote an application, Screensaver Ninja, that installs an screensaver for the user by copying it to ~/Library/Screen Savers. This works fine in my machine and the other developer's machine but in a testing machine I have, the file is there, if I let the screensaver activate, it selects it, but it doesn't appear on the list:
This is the code we use to install it:
func install() {
var err: NSError?
fileManager.copyItemAtURL(saverPackageUrl!, toURL: screensaversUrl!.URLByAppendingPathComponent("Ninja.saver"), error: &err)
if err != nil {
NSLog("Error installing Screensaver Ninja: \(err)")
}
}
and this is how we select it as default:
func setAsDefault() {
var mutable: NSMutableDictionary
if let moduleDict = CFPreferencesCopyAppValue("moduleDict", "com.apple.screensaver") as? NSDictionary {
mutable = moduleDict.mutableCopy() as NSMutableDictionary
} else {
mutable = NSMutableDictionary()
}
mutable.removeObjectForKey("displayName")
mutable["moduleName"] = "Ninja"
mutable["path"] = saverPath
mutable["type"] = 0
CFPreferencesSetValue("moduleDict", mutable as CFPropertyList, "com.apple.screensaver", kCFPreferencesCurrentUser, kCFPreferencesCurrentHost)
CFPreferencesAppSynchronize("com.apple.screensaver")
}
This is how it looks in my own machine (what I expected) after running that code:
Any ideas why it wouldn't work on a pristine mac?