微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

NSOSStatusErrorDomain Code=-54 “操作无法完成”设置备用应用程序图标时

如何解决NSOSStatusErrorDomain Code=-54 “操作无法完成”设置备用应用程序图标时

在我的 iOS 项目中,我尝试为我的 iOS 应用程序设置备用图标),并且图像文件(icon_1、icon_2、icon_3)在我的项目包中而不是 Assets.xcassets 中。 Info.list 像这样:

<key>CFBundleIcons</key>
<dict>
    <key>CFBundleAlternateIcons</key>
    <dict>
        <key>icon_1</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon_1</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
        <key>icon_2</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon_2</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
        <key>icon_3</key>
        <dict>
            <key>CFBundleIconFiles</key>
            <array>
                <string>icon_3</string>
            </array>
            <key>UIPrerenderedIcon</key>
            <false/>
        </dict>
    </dict>
    <key>CFBundlePrimaryIcon</key>
    <dict>
        <key>CFBundleIconFiles</key>
        <array>
            <string>AppIcon</string>
        </array>
    </dict>
</dict>

我将备用图标设置为源代码

[[UIApplication sharedApplication] setAlternateIconName:@"icon_1" completionHandler:^(NSError *error) {}

但是,图标不会改变并出现错误

Error Domain=NSOsstatusErrorDomain Code=-54 "The operation Couldn’t be completed."

我该如何解决这个问题?

谢谢:)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。