iOS10.3新功能Demo

README

iOS 10.3 增加了两个开发者比较关心的特性:

  1. 更换app icon
  2. 应用内评论

demo地址: https://github.com/summer-wu/iOS10d3Demo

更换app icon

1 . 在info.plist中添加两个字段 CFBundleAlternateIcons 和 CFBundlePrimaryIcon

注意:根据我的测试,CFBundlePrimaryIcon是必须的,否则一直显示默认icon。

CFBundleIcons

    CFBundleAlternateIcons
    
        AppIcon2
        
            CFBundleIconFiles
            
                AppIcon2
            
            UIPrerenderedIcon
            
        
    
    CFBundlePrimaryIcon
    
        CFBundleIconFiles
        
            AppIcon60x60
        
    

2 . 添加 [email protected] [email protected] 到项目中(不能添加到Assets.xcassets)

根据我的测试,添加到Assets.xcassets不生效

3 . 添加代码

if ([app supportsAlternateIcons]) {
        [app setAlternateIconName:@"AppIcon2" completionHandler:^(NSError * _Nullable error) {
            dispatch_async(dispatch_get_main_queue(), ^{
                [self updateLabel];
            });
        }];
}

应用内评论

#import 
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

你可能感兴趣的:(iOS10.3新功能Demo)