0

我有 2 个 iOS 项目。我们称它们为 A 和 B。A 是包含 2 个产品的库项目:

  • 一个静态库
  • 并且捆绑文件有一些 .xib 文件

B 是使用项目 A 的库和捆绑文件的应用程序项目。

项目 A 有 2 个东西:一个表格(自定义 UIViewController 类和一个 .xib 文件)和一个单元格(自定义 UITableViewCell 和 .xib 文件)

问题是:

项目 B 可以从库和包中加载表,但不能为该表加载单元格。

这是一个开源项目,我卡了几天,请帮助我。 https://github.com/G3Feng/granpost-ios

错误:

2013-09-18 07:28:50.184 TabbedDemo[34408:c07] |cell| load bundle:NSBundle </Users/Feng/Library/Application Support/iPhone Simulator/6.1/Applications/359F9352-F3BA-4478-AA51-A182D8CFA4AA/TabbedDemo.app/GPResource.bundle> (not yet loaded)
2013-09-18 07:28:50.185 TabbedDemo[34408:c07] Unknown class articleListCell in Interface Builder file.
2013-09-18 07:28:50.204 TabbedDemo[34408:c07] Could not load the "commentbubble-01.png" image referenced from a nib in the bundle with identifier "(null)"
2013-09-18 07:28:50.206 TabbedDemo[34408:c07] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UITableViewCell 0x71598b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key bottomBar.'
*** First throw call stack:
(0x1c97012 0x10d4e7e 0x1d1ffb1 0xb80e41 0xb025f8 0xb020e7 0x68f23 0xb2cb58 0x236019 0x10e8663 0x1c9245a 0x234b1c 0x2368da 0x39a0 0xd38fb 0xd39cf 0xbc1bb 0xccb4b 0x692dd 0x10e86b0 0x2293fc0 0x228833c 0x2288150 0x22060bc 0x2207227 0x22a9b50 0x2eedf 0x1c5fafe 0x1c5fa3d 0x1c3d7c2 0x1c3cf44 0x1c3ce1b 0x1bf17e3 0x1bf1668 0x18ffc 0x2b1d 0x2a45)
libc++abi.dylib: terminate called throwing an exception
4

2 回答 2

2

这个终于解决了这个问题:https ://stackoverflow.com/a/6092090/1571946

==>

这与 Interface Builder 没有任何关系,这里发生的是 Xcode 没有从静态库中加载符号。

要解决此问题,您需要将-all_load -ObjC标志添加Other Linker FlagsBuild Settings.

于 2013-09-20T05:06:17.387 回答
0

每次从另一个包访问资源时检查。试试这个代码。

NSBundle *yourBundleObject = [NSBundle bundleWithIdentifier:@"yourBundleIdentifier"];
if(![yourBundleObject isLoaded]){
   [yourBundleObject load];
}
于 2013-09-18T15:51:11.383 回答