Skip to content

Commit 4b5fa29

Browse files
committed
fix(ios): main thread
1 parent 12a5e80 commit 4b5fa29

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

packages/pixlive/ios/Plugin/Pixlive.swift

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,23 @@ import VDARSDK
3030
try? fileManager.createDirectory(atPath: storagePath, withIntermediateDirectories: true)
3131
}
3232

33-
VDARSDKController.startSDK(storagePath, withLicenseKey: licenseKey)
34-
guard let controller = VDARSDKController.sharedInstance() else { return }
35-
if let apiUrl = apiUrl {
36-
VDARRemoteController.sharedInstance()?.customAPIServer = apiUrl
37-
}
38-
if let sdkUrl = sdkUrl {
39-
VDARRemoteController.sharedInstance()?.customSdkServer = sdkUrl
40-
}
41-
controller.enableCodesRecognition = true
42-
let cameraSender = VDARCameraImageSource()
43-
controller.imageSender = cameraSender
44-
controller.detectionDelegates.add(self)
45-
VDARRemoteController.sharedInstance()?.delegate = self
46-
isInitialized = true
47-
completion(nil)
33+
DispatchQueue.main.async {
34+
VDARSDKController.startSDK(storagePath, withLicenseKey: licenseKey)
35+
guard let controller = VDARSDKController.sharedInstance() else { return }
36+
if let apiUrl = apiUrl {
37+
VDARRemoteController.sharedInstance()?.customAPIServer = apiUrl
38+
}
39+
if let sdkUrl = sdkUrl {
40+
VDARRemoteController.sharedInstance()?.customSdkServer = sdkUrl
41+
}
42+
controller.enableCodesRecognition = true
43+
let cameraSender = VDARCameraImageSource()
44+
controller.imageSender = cameraSender
45+
controller.detectionDelegates.add(self)
46+
VDARRemoteController.sharedInstance()?.delegate = self
47+
self.isInitialized = true
48+
completion(nil)
49+
}
4850
}
4951

5052
@objc public func synchronize(_ options: SynchronizeOptions, completion: @escaping (_ error: Error?) -> Void) {

0 commit comments

Comments
 (0)