Symbol not found: _PKPaymentNetworkPagoBancomat

70 views Asked by At

So in my app i have integrated ApplePay with Xcode Version 15.0 (15A240d) and my app's minimum iOS version is v16.

What I'm doing is literally mapping web PaymentNetwork into PKPaymentNetwork. When i run may app on iOS 16.4 simulator it just crashing with following message.

dyld[63845]: Symbol not found: _PKPaymentNetworkPagoBancomat
  Referenced from: <BACBF79F-6485-3A1B-84CA-A343341FA5A6> /Users/user.name/Library/Developer/CoreSimulator/Devices/2F7896EF-64AE-40CF-B712-DF4F2DCFF887/data/Containers/Bundle/Application/2D15AF1A-8479-4C03-A674-CF9F3A721573/MyApp.app/MyApp
  Expected in:     <6C22B2D4-5F5B-3FA9-825B-BDA166D45320> /Library/Developer/CoreSimulator/Volumes/iOS_20E247/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 16.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/PassKit.framework/PassKit

Here is the code that I'm trying to execute.

Note that it's working with iOS 17!

public enum ApplePayNetwork: String, Codable {
    case amex = "amex"
    case bancomat = "bancomat"
    case bancontact = "bancontact"
    case cartesBancaires = "cartesBancaires"
    case chinaUnionPay = "chinaUnionPay"
    case dankort = "dankort"
    case discover = "discover"
    case eftpos = "eftpos"
    case electron = "electron"
    case elo = "elo"
    case girocard = "girocard"
    case interac = "interac"
    case jcb = "jcb"
    case mada = "mada"
    case maestro = "maestro"
    case masterCard = "masterCard"
    case mir = "mir"
    case privateLabel = "privateLabel"
    case visa = "visa"
    case vPay = "vPay"
    
    public init?(pkPaymentNetwork: PKPaymentNetwork?) {
        guard let pkPaymentNetwork else {
            return nil
        }
        switch pkPaymentNetwork {
        case .amex:
            self = .amex
        case .pagoBancomat:
            self = .bancomat
        case .bancontact:
            self = .bancontact
        case .cartesBancaires:
            self = .cartesBancaires
        case .chinaUnionPay:
            self = .chinaUnionPay
        case .dankort:
            self = .dankort
        case .discover:
            self = .discover
        case .eftpos:
            self = .eftpos
        case .electron:
            self = .electron
        case .elo:
            self = .elo
        case .girocard:
            self = .girocard
        case .interac:
            self = .interac
        case .JCB:
            self = .jcb
        case .mada:
            self = .mada
        case .maestro:
            self = .maestro
        case .masterCard:
            self = .masterCard
        case .mir:
            self = .mir
        case .privateLabel:
            self = .privateLabel
        case .visa:
            self = .visa
        case .vPay:
            self = .vPay
        default:
            return nil
        }
    }
    
    public var toAppNetwork: PKPaymentNetwork {
        switch self {
        case .amex:
            return .amex
        case .bancomat:
            return .pagoBancomat
        case .bancontact:
            return .bancontact
        case .cartesBancaires:
            return .cartesBancaires
        case .chinaUnionPay:
            return .chinaUnionPay
        case .dankort:
            return .dankort
        case .discover:
            return .discover
        case .eftpos:
            return .eftpos
        case .electron:
            return .electron
        case .elo:
            return .elo
        case .girocard:
            return .girocard
        case .interac:
            return .interac
        case .jcb:
            return .JCB
        case .mada:
            return .mada
        case .maestro:
            return .maestro
        case .masterCard:
            return .masterCard
        case .mir:
            return .mir
        case .privateLabel:
            return .privateLabel
        case .visa:
            return .visa
        case .vPay:
            return .vPay
        }
    }
}
1

There are 1 answers

2
Clément Cardonnel On

PKPaymentNetwork.pagoBancomat is only available starting from iOS 17.0. Which means that any mention of this network should be encapsulated inside an availability check such as:

if #available(iOS 17.0, *) {
    return .pagoBancomat
}

But since you're using a switch, you're probably going to have to use the default clause to deal with this specific network. You'll probably have to do something similar with tmoney as this network is also only available starting from iOS 17.0.

However, it looks like there's something wrong with the pagoBancomat network that goes beyond that. Even using the if #available conditional, my app crashes at launch on iOS 16.3.

I decided to avoid mentioning pagoBancomat altogether for now. But if I'm not alone noticing this issue, I'll file a feedback to Apple, it may be a bug on the SDK level, which could be fixed in a subsequent version of Xcode.

Notes:

  • I'm using Xcode 15.0.1.
  • I have tried cleaning the project and removing derived data.