Closed robinvan0418 closed 2 years ago
@robinvan0418 Thanks for sharing. We'll take a look. What is the version of the swfit sdk?
@robinvan0418 Can you also share a code snippet for Optimizely SDK initialization. I see an unexpected flow (async init inside datafile download completion handler) in the posted crash report.
@jaeopt The sdk version is 3.10.0
MainViewController
var optimizelyWrapperFactory: OptimizelyWrapperFactoryProtocol = Resolver.optimizely.resolve()
func onAppStart() {
optimizelyWrapperFactory.createInstance(sdkKey: optimizelySDKKey)
let optimizelyWrapper = optimizelyWrapperFactory.instance
optimizelyWrapper?.initialize {
onMainThreadAsync { [unowned self] in
// Access flags
}
}
}
OptimizelyWrapperFactory
func createInstance(sdkKey: String) {
let optimizelyClient = OptimizelyClient(
sdkKey: sdkKey,
userProfileService: OptimizelyCustomUserProfileService(),
periodicDownloadInterval: Constants.OptimizelyConfig.periodicDownloadInterval
)
instance = OptimizelyWrapper(appLogger: appLogger,
cookieManager: cookieManager,
client: optimizelyClient,
trackingRepository: trackingRepository)
}
OptimizelyWrapper
func initialize(completion: @escaping () -> Void) {
client.start(resourceTimeout: nil) { result in
switch result {
case .success:
self.cookieManager.get(cookie: .browserId) { browserId in
guard let browserId = browserId else {
completion()
return
}
self.browserId = browserId
self.isClientInitialized = true
completion()
}
case .failure(let error):
self.isClientInitialized = false
completion()
}
}
}
@robinvan0418 Thanks for sharing the codes. They all look good to me. We'll take a look.
Hi @jaeopt, will there be a release anytime soon so we can try this out?
@robinvan0418 we'll release the patch this week and get you updated. Tx!
@robinvan0418 we released the patch 3.10.1. Let us know if it helps to fix your crashes.
@jaeopt So far we had no crashes with the patch. Looks good :) Thanks!
Hi there,
we observed some crashes in our app after implementing the OptimizelySDK. It seems to be very similar to this closed issue: https://github.com/optimizely/swift-sdk/issues/421
This crash occurred on iOS 14.x and 15.x devices.
This crash also happens at the ProjectConfig and occurred on iOS 13.x, 14.x and 15.x devices.