ionic capacitor JSValueEncodingContainer报错

  • try to clean the build folder.

    exit Xcode.

  • upgrade your capacitor core libraries

  • update cocoapods to 1.13.0

  • do "pod install --repo-udpdate"

after that:

  • ionic build --prod
  • npx cap update
  • npx cap sync
  • npx cap open ios

capacitor ios最低版本要求13

[Bug]: JSValueEncoder · Issue #7244 · ionic-team/capacitor · GitHub

麻了, 把报错的EncodingContainer方法替换成

private enum EncodingContainer: JSValueEncodingContainer {
    case singleValue(SingleValueContainer)
    case unkeyed(UnkeyedContainer)
    case keyed(AnyKeyedContainer)

    var data: JSValue? {
        switch self {
        case let .singleValue(container):
            return container.data
        case let .unkeyed(container):
            return container.data
        case let .keyed(container):
            return container.data
        }
    }

    var type: String {
        switch self {
        case .singleValue:
            return "SingleValueContainer"
        case .unkeyed:
            return "UnkeyedContainer"
        case .keyed:
            return "KeyedContainer"
        }
    }
}
相关推荐
独立开发者张张8 个月前
我用 Flutter、React Native 和 Ionic 构建了相同的应用程序
flutter·react native·ionic
ModyQyW10 个月前
Nuxt + Ionic 本地开发
前端·nuxt.js·ionic