gpt4 book ai didi

ios - 在 NSBundle 中加载自定义 NSBundle

转载 作者:行者123 更新时间:2023-11-29 01:02:32 26 4
gpt4 key购买 nike

NSBundle *customBundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"CustomBundle" ofType:@"bundle"]];

当我执行上述代码时,它会在 Debug模式和临时构建中返回customBundle。但当我在 TestFlight Build/App Store Build 中使用 32 位设备执行时,它会返回 nil。此外,customBundle 通过 CocoaPods 添加到主包中。我使用的是 Xcode 7.3。

我只在 iOS 9+ 上遇到这个奇怪的错误,它在 iOS 8 中完美运行。对于 iOS 8,它可以与所有 Build/Adhoc/Appstore 版本(包括所有 32 位和 64 位设备)正常运行。

最佳答案

我遇到了同样的问题。

这个错误是因为当你在 64 位设备上构建 bundle 时,xcode 添加到 bundle 内的 info.plist 的关键 UIRequiredDeviceCapabilities。(仅针对事件架构在 Debug模式下构建 bundle )

<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>

您可以通过删除 info.plist 中的 UIRequiredDeviceCapabilities 键或仅使用 32 位设备重建 bundle 并更新 podspec 来解决该错误。

关于ios - 在 NSBundle 中加载自定义 NSBundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36846415/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com