README
iOS 10.3 增加了两个开发者比较关心的特性:
- 更换app icon
- 应用内评论
demo地址: https://github.com/summer-wu/iOS10d3Demo
更换app icon
1 . 在info.plist中添加两个字段 CFBundleAlternateIcons 和 CFBundlePrimaryIcon
注意:根据我的测试,CFBundlePrimaryIcon是必须的,否则一直显示默认icon。
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>AppIcon2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon2</string>
</array>
<key>UIPrerenderedIcon</key>
<false/>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon60x60</string>
</array>
</dict>
</dict>
2 . 添加 AppIcon2@2x.png AppIcon2@3x.png 到项目中(不能添加到Assets.xcassets)
根据我的测试,添加到Assets.xcassets不生效
3 . 添加代码
if ([app supportsAlternateIcons]) {
[app setAlternateIconName:@"AppIcon2" completionHandler:^(NSError * _Nullable error) {
dispatch_async(dispatch_get_main_queue(), ^{
[self updateLabel];
});
}];
}
应用内评论
#import <StoreKit/StoreKit.h>
if ([UIDevice currentDevice].systemVersion.floatValue >= 10.3) {
[SKStoreReviewController requestReview];
}
refrence
https://forums.developer.apple.com/message/207848#207848
https://developer.apple.com/library/prerelease/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-SW14
https://github.com/steventroughtonsmith/AlternateIconTest