Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expected method to read dictionary element not found on object of type 'id<NSCopying>'

I am using Cocos2d-ObjC in my app and recently upgraded Xcode to v9.3. Now I have an error in "CCRendererBasicTypes.m" which says

"Expected method to read dictionary element not found on object of type 'id<NSCopying>'"

Everything else is working fine. This is the part of CCRendererBasicTypes

-(id)objectForKey:(id<NSCopying>)options
{
    CCBlendMode *blendMode = [self rawObjectForKey:options];
    if(blendMode) return blendMode;

    // Normalize the blending mode to use for the key.
    id src = (options[CCBlendFuncSrcColor] ?: @(GL_ONE));
    id dst = (options[CCBlendFuncDstColor] ?: @(GL_ZERO));
    id equation = (options[CCBlendEquationColor] ?: @(GL_FUNC_ADD));

    NSDictionary *normalized = @{
        CCBlendFuncSrcColor: src,
        CCBlendFuncDstColor: dst,
        CCBlendEquationColor: equation,

        // Assume they meant non-separate blending if they didn't fill in the keys.
        CCBlendFuncSrcAlpha: (options[CCBlendFuncSrcAlpha] ?: src),
        CCBlendFuncDstAlpha: (options[CCBlendFuncDstAlpha] ?: dst),
        CCBlendEquationAlpha: (options[CCBlendEquationAlpha] ?: equation),
    };

    // Create the key using the normalized blending mode.
    blendMode = [super objectForKey:normalized];

    // Make an alias for the unnormalized version
    [self makeAlias:options forKey:normalized];

    return blendMode;
}

The error appears in every line with

options[...]
like image 284
Scooby Don't Avatar asked May 04 '18 00:05

Scooby Don't


1 Answers

Change the first line to

-(id)objectForKey:(NSDictionary*)options
like image 169
Hristo Avatar answered Sep 23 '22 20:09

Hristo