请教高手ios静态库crash问题,我按照网上的方法创建静态库,但是使用bundle的时候出了问题,2013-05-18 15:31:08.085 testResLib[2721:11303] test link nib
2013-05-18 15:31:08.117 testResLib[2721:11303] initWithNibName bundle = NSBundle </Users/liuyun/Library/Application Support/iPhone Simulator/6.0/Applications/D429A3A3-0C0B-4C95-99A4-5708F8DE2A7A/testResLib.app/TestResource.bundle> (not yet loaded)
2013-05-18 15:31:08.118 testResLib[2721:11303] initWithNibName [NSBundle mainBundle] = NSBundle </Users/liuyun/Library/Application Support/iPhone Simulator/6.0/Applications/D429A3A3-0C0B-4C95-99A4-5708F8DE2A7A/testResLib.app> (loaded)
2013-05-18 15:31:08.119 testResLib[2721:11303] [NSBundle allBundles] = (
    "NSBundle </Users/liuyun/Library/Application Support/iPhone Simulator/6.0/Applications/D429A3A3-0C0B-4C95-99A4-5708F8DE2A7A/testResLib.app> (loaded)",
    "NSBundle </Users/liuyun/Library/Application Support/iPhone Simulator/6.0/Applications/D429A3A3-0C0B-4C95-99A4-5708F8DE2A7A/testResLib.app/TestResource.bundle> (not yet loaded)"
)
2013-05-18 15:31:08.120 testResLib[2721:11303] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/liuyun/Library/Application Support/iPhone Simulator/6.0/Applications/D429A3A3-0C0B-4C95-99A4-5708F8DE2A7A/testResLib.app/TestResource.bundle> (not yet loaded)' with name 'LYTestViewController''
*** First throw call stack:
(0x1c8f012 0x10cce7e 0x1c8edeb 0x22ffac 0xf4e37 0xf5418 0xf5648 0xf5882 0xf5b2a 0x10cef5 0x10cfdb 0x10d286 0x10d381 0x10deab 0x10e4a3 0x10e098 0x2fc0 0x10e0705 0x17920 0x178b8 0xd8671 0xd8bcf 0xd7d38 0x4733f 0x47552 0x253aa 0x16cf8 0x1beadf9 0x1beaad0 0x1c04bf5 0x1c04962 0x1c35bb6 0x1c34f44 0x1c34e1b 0x1be97e3 0x1be9668 0x1465c 0x26bd 0x25e5)
libc++abi.dylib: terminate called throwing an exception主要是没有load可用bundle到指定的app中。iOS静态库bundle

解决方案 »

  1.   

    自定义的静态库,我已经改用framework了
      

  2.   

    既然没有load,就查load bundle的那几句代码,有很多种情况。
    有可能你在静态库中用了[NSBundle mainBundle],肯定加载不上,因为静态库所在的bundle不是mainBundle;如果bundle没有读错,但只是加载不上,那就用类似于–loadAndReturnError:和–isLoaded这样的方法来获取是否load成功,如果不成功,就打印loadAndReturnError中的error参数看一看原因。