gpt4 book ai didi

objective-c - 读取字典元素的预期方法在 'id' 类型的对象上找不到

转载 作者:太空狗 更新时间:2023-10-30 03:37:43 25 4
gpt4 key购买 nike

我在我的应用程序中使用 Cocos2d-ObjC,最近将 Xcode 升级到 v9.3。现在我在“CCRendererBasicTypes.m”中有一个错误,上面写着

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

其他一切正常。这是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;
}

错误出现在每一行

options[...]

最佳答案

将第一行改为

-(id)objectForKey:(NSDictionary*)options

关于objective-c - 读取字典元素的预期方法在 'id<NSCopying>' 类型的对象上找不到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50165389/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com