ios - 图像 Assets : Could not load the image referenced from a nib in the bundle with identifier

标签 ios xcode swift storyboard xcasset

我在 Download 文件夹中有一个 compass.jpg 文件。然后我将此图像拖到我的 Images.xcassets 中。我通过右键单击图像条目和 view folder 确保图像确实在文件夹中。

然后,在 Storyboard中,我将我的 Logo ImageView 设置为此图像,并使用名称 compass。这一切都在 Storyboard 中显示得很好。

但是,然后,我在我的 iPhone 和模拟器中启动了我的应用程序。它给了我以下错误:

Could not load the "compass" image referenced from a nib in the 
bundle with identifier "com.x.Point"

我不知道如何解决这个问题。图像的文件夹确实在 Images.xcassets 文件夹中。

我该如何解决这个问题?

更新

我最终不得不做出妥协,将图像添加到项目本身而不是其 .imageassets 文件夹中。

我实际上创建了一个新项目并将我的所有源代码复制并粘贴到那里,然后 .imageasset 文件夹再次工作!我想这不是我项目设置的问题。它一定与 XCode 有关,我仍然不确定。

最佳答案

您需要将图像拖到 Image.xcassets 文件夹之外并拖到您的项目中。 xcassets 文件仅用于初始图像和图标。

关于ios - 图像 Assets : Could not load the image referenced from a nib in the bundle with identifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28044272/

相关文章:

java - 识别用户何时开车、步行、骑自行车

ios - Keychain 中的 SecItemCopyMatching 和 kSecAttrAccessible

ios - 在 View 出现后以编程方式更改 View

ios - 如何在 Xcode 5 及更高版本中删除派生数据和清理项目?

ios - Swift:在 TableView 单元格中创建 UILabel

ios - 在 Swift 中的整数后显示 .0

ios - Apple Watch 让应用保持活跃几秒钟

iOS - 钥匙串(keychain)中的 Apple Development Push Certificate 旁边没有三角形

iPhone:停止程序在后台运行

ios - 如何在用户快速点击 firebase 通知后显示警报?