我正在尝试在我的GameManager单例初始化中构建一些场景。
该场景是通过
- (id)init
{
self = [super init];
if (self) { // 'mainScene' is an autorelease object.
mainScene = [CCScene node];
...
}GameManger对mainScene有很强的引用:
@interface GameManager : NSObject
{
CCScene* mainScene;
}但如果我稍后尝试用
[[CCDirector sharedDirector] pushScene:mainScene]; 我得到了EXC_BAD_ACCESS
如果我创建并立即推送,那么一切都会正常工作。默认的__strong引用不应该保留已分配的对象吗?
提前感谢您的帮助……
发布于 2012-06-15 05:31:53
弄清楚了..。CCScene节点是一个方便的工厂方法,它做:[[self alloc init] autorelease];
但是由于我使用的是圆弧,所以我不想这样,我想
mainScene = [[CCScene alloc]init];而不是
mainScene = [CCScene node];https://stackoverflow.com/questions/11041336
复制相似问题