Textures loaded with NSOperation are blank

Posted by Omega on Stack Overflow See other posts from Stack Overflow or by Omega
Published on 2012-03-19T02:00:43Z Indexed on 2012/03/19 2:03 UTC
Read the original article Hit count: 185

Filed under:
|

So I call this method:

-(void)beginExecution {
    NSOperationQueue *queue = [NSOperationQueue new];

    NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self
                                                                            selector:@selector(execute)
                                                                              object:nil];

    [queue addOperation:operation];
    [operation release];
}

Which triggers this:

-(void)execute {
    [[CCSpriteFrameCache sharedSpriteFrameCache]addSpriteFramesWithFile:@"MyTexture.plist"];
    loaded = YES; // This tells me whenever loading is done.
}

However, when I create a sprite and try to use the texture MyTexture.png, the sprite is a blank canvas. Why is that?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocos2d-iphone