diff --git a/mParticle-Apple-SDK/Kits/MPKitContainer.mm b/mParticle-Apple-SDK/Kits/MPKitContainer.mm index 9f6d42e6..37364fc8 100644 --- a/mParticle-Apple-SDK/Kits/MPKitContainer.mm +++ b/mParticle-Apple-SDK/Kits/MPKitContainer.mm @@ -517,7 +517,13 @@ - (void)startKitRegister:(nonnull id)kitRegister configu } if ([kitRegister.wrapperInstance respondsToSelector:@selector(didFinishLaunchingWithConfiguration:)]) { - [kitRegister.wrapperInstance didFinishLaunchingWithConfiguration:configuration]; + if ([NSThread isMainThread]) { + [kitRegister.wrapperInstance didFinishLaunchingWithConfiguration:configuration]; + } else { + dispatch_async(dispatch_get_main_queue(), ^{ + [kitRegister.wrapperInstance didFinishLaunchingWithConfiguration:configuration]; + }); + } } } } diff --git a/mParticle-Apple-SDK/MPBackendController.m b/mParticle-Apple-SDK/MPBackendController.m index 057b7c91..c5355689 100644 --- a/mParticle-Apple-SDK/MPBackendController.m +++ b/mParticle-Apple-SDK/MPBackendController.m @@ -1474,7 +1474,7 @@ - (void)startWithKey:(NSString *)apiKey secret:(NSString *)secret networkOptions } if (![MParticle sharedInstance].stateMachine.optOut) { - dispatch_async(dispatch_get_main_queue(), ^{ + dispatch_async([MParticle messageQueue], ^{ [[MParticle sharedInstance].kitContainer initializeKits]; }); }