Reputation: 37308
I'm seeing here in changes page that setApplicationIconImage
was deprecated. Man I couldn't believe it.
What is the an alternative for this now? Is there one that works in older versions then 10.10 too? If not its ok i can do version check and do setApplicationIconImage for <= 10.9 and the new way for >= 10.10.
Thanks
Upvotes: 1
Views: 642
Reputation: 1690
It looks like maybe they removed the method in favor of a property. So use this instead.
[NSApplication sharedInstance].applicationIconImage = myNewIconImage
From the NSApplication class reference,
Assign an image to this property when you want to temporarily change the app icon in the dock app tile. The image you provide is scaled as needed so that it fits in the tile. To restore your app’s original icon, set this property to nil. Available in OS X v10.0 and later.
Upvotes: 2
Reputation: 50129
The setApplicationIconImage
method did not get deprecated or removed.
Apple only changed the header to SHOW it as a property instead.
setApplicationIconImage
IS the setter for the property. properties are only syntactic sugar for two 'standard' methods: a getter (applicationIconImage) and a setter (setApplicationIconImage)
you might get an ARC warning nowadays because it can't see setApplicationIconImage so use the dot-notation on ALL platforms -> no need for a runtime check of 10.10/10.9
Upvotes: 5