关闭Cocos2D详细日志记录

时间:2013-09-19 06:21:43

标签: ios cocos2d-iphone

我刚刚升级到cocos 2.1,并且看到了大量的日志记录到控制台,例如:

2013-09-18 23:15:38.120 Notes and Clefs[842:907] cocos2d: deallocing <CCSprite = 0x1182aa0 | Rect = (816.00,640.00,32.00,64.00) | tag = -1 | atlasIndex = -1>
2013-09-18 23:15:38.121 Notes and Clefs[842:907] cocos2d: deallocing <CCSprite =  0x1182600 | Rect = (816.00,128.00,32.00,64.00) | tag = -1 | atlasIndex = -1>
2013-09-18 23:15:38.122 Notes and Clefs[842:907] cocos2d: deallocing <CCArray = 0x1161e00> = ( <CCSprite = 0x1182790 | Rect = (816.00,640.00,32.00,64.00) | tag = -1 | atlasIndex = -1>, )
etc..

从查看代码,我看到:

#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0
#define CCLOG(...) do {} while (0)
#define CCLOGWARN(...) do {} while (0)
#define CCLOGINFO(...) do {} while (0)

#elif COCOS2D_DEBUG == 1
#define CCLOG(...) __CCLOG(__VA_ARGS__)
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
#define CCLOGINFO(...) do {} while (0)

#elif COCOS2D_DEBUG > 1
#define CCLOG(...) __CCLOG(__VA_ARGS__)
#define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__)
#define CCLOGINFO(...) __CCLOG(__VA_ARGS__)
#endif // COCOS2D_DEBUG

我设置COCOS2D_DEBUG = 0,但我仍然得到相同的详细记录......

我的项目中有Cocos2D作为静态库.a文件..这个.a是否有可能在2级或类似物上定义了一个宏/常量,这就是为什么我看到它没有任何区别?

有人可以推荐一种解决方法吗?

1 个答案:

答案 0 :(得分:0)

是的,当使用Debug方案编译静态库时,它会打印出所有这些调试消息。尝试重新编译静态库,并将COCOS2D_DEBUG预处理器宏设置为1。

为什么要将它添加为静态.a库?我只是将cocos2d-ios.xcodeproj添加到我自己的项目中,并将libcocos2d.a添加到Link Binary with Libraries下的Build Phases。这样,只要发生变化,它就会自动重新编译cocos2d。