XCode16 HandyJson Metadata报错处理
2024-11-17 本文已影响0人
nick5683
针对 "HandyJSON Metadata error" 的问题,在Xcode 16环境下,根据搜索结果,有用户遇到了编译报错。具体错误信息为:
Function type mismatch, declared as '@convention(thin) (UnsafePointer<UInt8>, Int, Optional<UnsafeRawPointer>, Optional<UnsafeRawPointer>) -> Optional<@thick any Any.Type>' but used as '@convention(thin) (UnsafePointer<UInt8>, UInt, Optional<UnsafeRawPointer>, Optional<UnsafeRawPointer>) -> Optional<@thick any Any.Type>'
解决方案是将 HandyJSON/Source/Metadata.swift 里的 UInt 改为 Int,修改如下
:
// 原始内容是UInt
// "function": { _getTypeByMangledNameInContext(cMangledTypeName, UInt(getMangledTypeNameSize(cMangledTypeName)), genericContext: self.contextDescriptorPointer, genericArguments: self.genericArgumentVector) }
// 改成Int
"function": { _getTypeByMangledNameInContext(cMangledTypeName, Int(getMangledTypeNameSize(cMangledTypeName)), genericContext: self.contextDescriptorPointer, genericArguments: self.genericArgumentVector) }