【发布时间】:2011-11-19 16:47:46
【问题描述】:
我的目标是 iOS(设备和模拟器)并设置 CMake 以在包中添加所需的不同资源。 “xib”文件给了我一些问题。如果我不采取进一步措施,iPhone/iPad 模拟器运行将失败并出现以下错误:
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'Could not load NIB in bundle:
'NSBundle </Users/danieldekkers/Library/Application Support/iPhone Simulator/4.3.2/Applications/1C29638B-7593-4311-8F94-C8051AF90AD7/Discs.app>
(loaded)' with name 'MainWindow''
捆绑包中缺少 NIB 文件。 一个示例 (http://www.vtk.org/Wiki/CMake:OSX_InterfaceBuilderFiles) 显示,对于 OSX,您必须将 xib 文件编译为 nib 文件,并将这些文件作为构建后步骤添加到包中。 所以我的猜测是 iOS 也有类似的情况。 但我的问题是,...我在哪里添加编译的 nib 文件?
我现在在 CMakeLists.txt 中执行此操作:
# We need to compile the interface builder *.xib files to *.nib files to add to the bundle
# Make sure we can find the 'ibtool' program. If we can NOT find it we skip generation of this project
FIND_PROGRAM( IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin" )
if ( ${IBTOOL} STREQUAL "IBTOOL-NOTFOUND" )
MESSAGE( SEND_ERROR "ibtool can not be found" )
ENDIF()
# Compile the .xib files using the 'ibtool' program with the destination being the app package
FOREACH( xib ${RSRC_IOS_XIB_FILES} )
ADD_CUSTOM_COMMAND( TARGET ${RT_APP_NAME} POST_BUILD
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
--compile
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${RT_APP_NAME}.app/Contents/Resources/${xib}.nib
${RT_APP_ROOT}/rsrc/apple/ios/${xib}.xib
COMMENT "Compiling ${RT_APP_ROOT}/rsrc/apple/ios/${xib}.xib")
ENDFOREACH()
但我并不真正相信编译步骤的“目的地”,尤其是对于模拟器。
有没有人解决这个问题或者看看我做错了什么?
【问题讨论】:
-
如果有人感兴趣,我正在寻找这个问题的答案。