Click here to Skip to main content
14,977,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have searched many places for something remotely similar and found nothing. I'm upgrading cocos2d in my iphone xcode 6.1 project. I am upgrading to cocos2d 2.0 since I am using CocosBuilder 2.x. But after resolving many errors, I'm not understanding this particular one. I've listed the code directly from the CCBReader.m file. This code is giving me an error when attempting to create a reference to a new CCNode* with a NSValue*. Here is the error:
Objective-C
[...]/CCBReader/CCBReader.mm:1072:17: Cannot initialize a variable of type 'CCNode *' with an rvalue of type 'void *'

at this line:
Objective-C
CCNode* node = [pointerValue pointerValue];

This is the creation of the pointerValue from the NSValue.h file:
Objective-C
- (void *)pointerValue;

Here is the whole method:
Objective-C
+ (CCNode*) nodeGraphFromData:(NSData*) data owner:(id)owner parentSize:(CGSize)parentSize
{
    CCBReader* reader = [[[CCBReader alloc] initWithData: data owner:owner] autorelease];
    reader.actionManager.rootContainerSize = parentSize;
    
    NSMutableDictionary* animationManagers = [NSMutableDictionary dictionary];
    CCNode* nodeGraph = [reader readFileWithCleanUp:YES actionManagers:animationManagers];
    
    if (nodeGraph && reader.actionManager.autoPlaySequenceId != -1)
    {
        // Auto play animations
        [reader.actionManager runAnimationsForSequenceId:reader.actionManager.autoPlaySequenceId tweenDuration:0];
    }
    
    // Assign actionManagers to userObject
    for (NSValue* pointerValue in animationManagers)
    {
        CCNode* node = [pointerValue pointerValue]; // <<== This is where I get the error.
        
        CCBAnimationManager* manager = [animationManagers objectForKey:pointerValue];
        node.userObject = manager;
    }
    
    // Call didLoadFromCCB
    [CCBReader callDidLoadFromCCBForNodeGraph:nodeGraph];
    
    return nodeGraph;
}


Any ideas of what the problem is? I'm using standard files directly from the frameworks, so that's why I'm so confused. I don't think I'd need to modify the CCBReader file, but maybe some other file? Thanks for any help.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900