【问题标题】:Unable to add images to image button in Xcode无法将图像添加到 Xcode 中的图像按钮
【发布时间】:2023-03-28 18:26:01
【问题描述】:

我是 macOS 应用程序开发的新手,我正在尝试将图像按钮添加到我的视图中,并且我想在文本之后看到图像,所以我将图像按钮拖放到视图控制器并编写标题,然后,在图像部分,我选择我的图像。

但我的问题是,如果我将选择系统图像,我的项目可以完美运行,但如果我将通过单击项目名称 > 将文件添加到.. 并将 png、jpg、jpeg 文件导入我的项目并选择此图像来导入文件Xcode 给了我这个错误;

CodeSign build/Debug/test.app
    cd /Users/feora/Documents/apps/test
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --entitlements /Users/feora/Documents/apps/test/build/test.build/Debug/test.build/test.app.xcent --timestamp=none /Users/feora/Documents/apps/test/build/Debug/test.app

/Users/feora/Documents/apps/test/build/Debug/test.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1

this page 有问题,但我找不到哪个

【问题讨论】:

  • 请具体说明您要做什么。你到底在哪里卡住了。
  • 您好 Janu,非常感谢您的回答 :) 我只想添加图像框并在构建项目时能够看到此图像。我可以使用系统图片构建项目而不会出现任何错误。但是,当我通过单击“项目名称> 将文件添加到..”在桌面中添加外部图像时,我收到此错误。我不知道如何才能更具体。

标签: swift xcode macos imagebutton code-signing-certificate


【解决方案1】:

这是因为当您添加图像文件时,您还添加了一些与该图像相关的 Finder 元数据。如果你搜索过至少一点点错误,你会找到像this 这样的答案。

【讨论】:

  • 谢谢丹! :) 我试图解决这个问题几个小时,但我之前找不到答案。我已经通过打开终端解决了这个问题>转到应用程序文件夹>粘贴此代码“查找。-type f -name '*.png' -exec xattr -c {} \;”谢谢你:)
猜你喜欢
  • 1970-01-01
  • 2018-02-05
  • 2020-08-24
  • 2012-09-11
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多