3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

審査なしでiOSアプリのアイコンを変更する方法

Last updated at Posted at 2017-11-30

はじめに

アプリ内でアイコンを変更する機能を試したのでメモです。
期間限定でアイコンを変更したい場合などに使えそうです。

注意1

iOS10.3から使用可能な機能です。
それ以前のiOSをサポートしている場合はif #available(iOS 10.3, *) {とする必要があります。

注意2

アイコンを変更するとアラートが出ます。
IMG_3456.PNG

##やり方
###アイコンの追加
Assets.xcassetsではなく直接追加する必要があります。
60×60の@2x@3xを用意してください。

スクリーンショット 2017-11-30 21.26.59.png

###Info.plist
下記のようにCFBundleIconsを追加します。

	<key>CFBundleIcons</key>
	<dict>
		<key>CFBundleAlternateIcons</key>
		<dict>
			<key>redIcon60</key>
			<dict>
				<key>CFBundleIconFiles</key>
				<array>
					<string>redIcon60</string>
				</array>
				<key>UIPrerenderedIcon</key>
				<false/>
			</dict>
		</dict>
	</dict>

Source Code
スクリーンショット 2017-11-30 21.13.32.png

Property List
スクリーンショット 2017-11-30 21.12.41.png

コード

下記のようなコードを書きます。
※変更後にアラートが出ます。

デフォルトのアイコンに戻す
UIApplication.shared.setAlternateIconName(nil, completionHandler: nil)
指定した画像ファイルに変更する
UIApplication.shared.setAlternateIconName("redIcon60", completionHandler: nil)

##GitHub
https://github.com/hideyukitone/IconChangeSample

##参考
https://www.gaprot.jp/pickup/ios10/alternate-icons

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?