diff --git a/platform-darwin/Source/MPTypes.h b/platform-darwin/Source/MPTypes.h index 47c52478..59ed8281 100644 --- a/platform-darwin/Source/MPTypes.h +++ b/platform-darwin/Source/MPTypes.h @@ -43,7 +43,7 @@ __END_DECLS \ if (__error && [[MPConfig get].sendInfo boolValue]) { \ SentryEvent *event = [[SentryEvent alloc] initWithLevel:kSentryLevelError]; \ - event.message = strf( message_ @": %@", ##__VA_ARGS__, [__error localizedDescription]); \ + event.message = [[SentryMessage alloc] initWithFormatted:strf( message_ @": %@", ##__VA_ARGS__, [__error localizedDescription])]; \ event.logger = @"MPError"; \ event.fingerprint = @[ message_, __error.domain, @(__error.code) ]; \ [SentrySDK captureEvent:event]; \ diff --git a/platform-darwin/Source/iOS/MPiOSAppDelegate.m b/platform-darwin/Source/iOS/MPiOSAppDelegate.m index 38e71335..0d8f07a6 100644 --- a/platform-darwin/Source/iOS/MPiOSAppDelegate.m +++ b/platform-darwin/Source/iOS/MPiOSAppDelegate.m @@ -60,22 +60,6 @@ MP_LIBS_END - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { @try { - // Sentry - [SentrySDK startWithOptions:@{ - @"dsn" : NilToNSNull( decrypt( sentryDSN ) ), -#ifdef DEBUG - @"debug" : @(NO), //@(YES), - @"environment" : @"Development", -#elif PUBLIC - @"debug" : @(NO), - @"environment" : @"Public", -#else - @"debug" : @(NO), - @"environment" : @"Private", -#endif - @"enabled" : @([[MPiOSConfig get].sendInfo boolValue] || ![[MPiOSConfig get].sendInfoDecided boolValue]), - @"enableAutoSessionTracking": @(YES), - }]; [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) { PearlLogLevel level = PearlLogLevelWarn; if ([[MPConfig get].sendInfo boolValue]) @@ -834,7 +818,23 @@ MP_LIBS_END if ([PearlLogger get].printLevel > PearlLogLevelInfo) [PearlLogger get].printLevel = PearlLogLevelInfo; - [SentrySDK.currentHub getClient].options.enabled = @YES; + // Sentry + if (!SentrySDK.isEnabled) + [SentrySDK startWithOptions:@{ + @"dsn" : NilToNSNull( decrypt( sentryDSN ) ), +#ifdef DEBUG + @"debug" : @(NO), //@(YES), + @"environment" : @"Development", +#elif PUBLIC + @"debug" : @(NO), + @"environment" : @"Public", +#else + @"debug" : @(NO), + @"environment" : @"Private", +#endif + @"enableAutoSessionTracking": @(YES), + }]; + [SentrySDK configureScope:^(SentryScope *scope) { [scope setExtraValue:[MPiOSConfig get].rememberLogin forKey:@"rememberLogin"]; [scope setExtraValue:[MPiOSConfig get].sendInfo forKey:@"sendInfo"]; @@ -859,7 +859,7 @@ MP_LIBS_END } else { [Countly.sharedInstance cancelConsentForFeatures:countlyFeatures]; - [SentrySDK.currentHub getClient].options.enabled = @NO; + [SentrySDK close]; } }