Reputation: 361
I have two app icons built-in (free and premium), is it possible to replace free icon to premium icon programmatically after in-app purchase is completed successfully?
Upvotes: 13
Views: 11869
Reputation: 83
An update: since iOS 10.3 you can update the app icon by having alternate icons defined in the info.plist.
See more at Apple Docs
Upvotes: 2
Reputation: 6715
There is a new solution for this situation.
You can use
setAlternateIconName(_:completionHandler:)
iOS 10.3 is out with xcode 8.3.
Update:
Usage is pretty simple, the key is to find out plist usage and note that you can not load assets from xcassets ( at least didnt work for me ). You need to add your icon files to project and prefer 180x180 images for quality.
You need to use "Icon files (iOS 5)", new Icon files does not work.
One last thing, when you change icon on a button click it will popup a Alert window that says 'You have changed the icon for "IcoTest".'
//ViewController.swift
@IBAction func ico1Click(_ sender: Any) {
if UIApplication.shared.supportsAlternateIcons{
UIApplication.shared.setAlternateIconName("Icon2", completionHandler: { (error) in
print(error ?? "")
})
}else{
print("NO NO")
}
}
//Info.plist
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>Icon1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>alternater1_180x180</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
<key>Icon2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>alternater2_180x180</string>
</array>
</dict>
</dict>
</dict>
Upvotes: 16
Reputation: 41
No, definitely not. That part of the application bundle is read-only, and also code signed.
The answer regarding the TapOne app is something completely different. It creates "web clips" to web sites or phone numbers. For example, to create an iPhone icon for your website, you would add something like this to your web page header:
<link rel="apple-touch-icon" href="/your-custom-icon.png"/>
There is more info available here: https://developer.apple.com/library/ios/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html
TapOne and web clips do not programmatically change the icon within an application bundle.
Upvotes: 4
Reputation: 15
I disagree with all the answer above. Please try the app "OneTap", it will allow you to make your own icon of your new app. OneTap app is free on Itune.
Upvotes: -1
Reputation: 781
This is not possible. App icons are not dynamic and they can only be updated by submitting a new updates to your app through iTunes Connect. For more info, read the iTunes Connect Developer Guide. https://itunesconnect.apple.com/docs/iTunesConnect_DeveloperGuide.pdf
Upvotes: 1
Reputation: 1152
I don't think that's possible without a jailbroken phone. The app icon is contained in the application bundle, which you're not allowed to write to.
Upvotes: 0
Reputation: 837
I'm afraid not; pretty certain the app icon isn't allowed to conditionally change.
Upvotes: 0
Reputation: 25144
No, the icon is specified in the application bundle, which you must not change. If you change it, your app signature will become invalid (not the same checksum) and thus your app won't run anymore.
Upvotes: 11