【发布时间】:2013-11-05 05:55:31
【问题描述】:
我在进行此设置时遇到问题。
我的播客文件:
platform :ios
pod 'cocos2d', '2.1'
pod 'box2d', '2.3.0'
不幸的是,我们需要打开CC_ENABLE_BOX2D_INTEGRATION,因为它默认设置为0。
我尝试向 podfile 添加一个 post_install 挂钩,如下所示:
post_install do |installer_representation|
installer_representation.project.targets.each do |target|
if target.name == 'Pods-cocos2d'
target.build_configurations.each do |config|
s = config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
if s == nil
s = [ '$(inherited)' ]
end
s.push('CC_ENABLE_BOX2D_INTEGRATION=1');
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = s
end
end
end
end
它按预期将标志添加到 Pods-cocos2d 目标,但我的主项目似乎在任何时候都没有继承它,尽管 GCC_PREPROCESSOR_DEFINITIONS 中有 $(inherited) 变量。
即便如此,如果我手动将CC_ENABLE_BOX2D_INTEGRATION 编辑为打开,我会收到链接器错误,提示找不到CCPhysicsSprite。
有没有人成功设置这两个库与 cocoapods 一起工作?
【问题讨论】:
标签: cocos2d-iphone box2d cocoapods