首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要的方法读取在类型为“”id<NSCopying>“”的对象上未找到的字典元素“”

需要的方法读取在类型为“”id<NSCopying>“”的对象上未找到的字典元素“”
EN

Stack Overflow用户
提问于 2018-05-04 08:10:34
回答 1查看 2.3K关注 0票数 8

我在我的应用中使用了Cocos2d-ObjC,最近将Xcode升级到了v9.3。现在我在"CCRendererBasicTypes.m“中有一个错误,它说

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

其他一切都运行得很好。这是CCRendererBasicTypes的一部分

代码语言:javascript
复制
-(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;
}

错误出现在每一行中

代码语言:javascript
复制
options[...]
EN

回答 1

Stack Overflow用户

发布于 2018-12-19 15:52:31

将第一行更改为

代码语言:javascript
复制
-(id)objectForKey:(NSDictionary*)options
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50165389

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档