how to use CFBundleAlternateIcons ?

how to use CFBundleAlternateIcons ?


in my info.plist:


    <key>CFBundleIcons</key>
    <dict>
        <key>CFBundlePrimaryIcon</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>Doodad.icns</string>
            </array>
        </dict>
        <key>CFBundleAlternateIcons</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>logo29x29</string>
                <string>logo40x40</string>
                <string>logo60x60</string>
            </array>
        </dict>
    </dict>


in my code :


    UIApplication *app  = [UIApplication sharedApplication];
    BOOL reuslt = app.supportsAlternateIcons;
    NSLog(@"%zd",reuslt);
    [app setAlternateIconName:@"logo" completionHandler:^(NSError * error) {
        NSLog(@"%@",error);
    }];
    [app setAlternateIconName:@"logo29x29" completionHandler:^(NSError * error) {
        NSLog(@"%@",error);
    }];
    [app setAlternateIconName:@"logo29x29@2x.png" completionHandler:^(NSError * error) {
        NSLog(@"%@",error);
    }];
    NSLog(@"name=%@",app.alternateIconName);


output is:


2017-01-25 15:10:44.267 Z2XY[9014:344340] 1
2017-01-25 15:10:44.271 Z2XY[9014:344340] name=(null)
2017-01-25 15:10:44.293 Z2XY[9014:344340] Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist." UserInfo={NSUnderlyingError=0x600000244620 {Error Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found in CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}}
2017-01-25 15:10:44.294 Z2XY[9014:344340] Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist." UserInfo={NSUnderlyingError=0x60800024fa20 {Error Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found in CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}}
2017-01-25 15:10:44.294 Z2XY[9014:344340] Error Domain=NSCocoaErrorDomain Code=4 "The file doesn’t exist." UserInfo={NSUnderlyingError=0x60800024fa80 {Error Domain=LSApplicationWorkspaceErrorDomain Code=-105 "iconName not found in CFBundleAlternateIcons entry" UserInfo={NSLocalizedDescription=iconName not found in CFBundleAlternateIcons entry}}}



how should I use CFBundleAlternateIcons


refer: 1. https://developer.apple.com/reference/uikit/uiapplication/2806818-setalternateiconname?changes=latest_minor&language=objc

2.

xcdoc://?url=developer.apple.com/library/prerelease/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/TP40009249-102043-TPXREF110

Same problem :/

We're discussing it here: https://forums.developer.apple.com/message/207848#207848

how to use CFBundleAlternateIcons ?
 
 
Q