From 3d730d873d5c30395ffafc8a2572578ba8174a3f Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Thu, 6 Feb 2020 18:49:36 +0100 Subject: [PATCH] fix(ios): avoid crash on Xcode 11.4 --- ios/Capacitor/Capacitor/CAPBridge.swift | 41 +++++++++++++------------ 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/ios/Capacitor/Capacitor/CAPBridge.swift b/ios/Capacitor/Capacitor/CAPBridge.swift index bc4a60dfa..54d368801 100644 --- a/ios/Capacitor/Capacitor/CAPBridge.swift +++ b/ios/Capacitor/Capacitor/CAPBridge.swift @@ -40,6 +40,8 @@ enum BridgeError: Error { public var scheme: String // Whether the app is active private var isActive = true + // Wheter to inject the Cordova files + private var injectCordovaFiles = false // Background dispatch queue for plugin calls public var dispatchQueue = DispatchQueue(label: "bridge") @@ -207,16 +209,6 @@ enum BridgeError: Error { * their JS. */ func setupCordovaCompatibility() { - var injectCordovaFiles = false - var numClasses = UInt32(0); - let classes = objc_copyClassList(&numClasses) - for i in 0...allocate(capacity: Int(classCount)) + + let releasingClasses = AutoreleasingUnsafeMutablePointer(classes) + let numClasses: Int32 = objc_getClassList(releasingClasses, classCount) + for i in 0..