diff --git a/Sources/Sentry/Processors/SentryWatchdogTerminationBreadcrumbProcessor.m b/Sources/Sentry/Processors/SentryWatchdogTerminationBreadcrumbProcessor.m index 385fbde8d87..146dbb5c22c 100644 --- a/Sources/Sentry/Processors/SentryWatchdogTerminationBreadcrumbProcessor.m +++ b/Sources/Sentry/Processors/SentryWatchdogTerminationBreadcrumbProcessor.m @@ -18,7 +18,7 @@ @interface SentryWatchdogTerminationBreadcrumbProcessor () @implementation SentryWatchdogTerminationBreadcrumbProcessor - (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs - fileManager:(SentryFileManager *)fileManager + fileManager:(SentryFileManager *_Nullable)fileManager { if (self = [super init]) { self.fileManager = fileManager; diff --git a/Sources/Sentry/SentryDefaultAppStateManager.m b/Sources/Sentry/SentryDefaultAppStateManager.m index d3f78549b2f..108562e707b 100644 --- a/Sources/Sentry/SentryDefaultAppStateManager.m +++ b/Sources/Sentry/SentryDefaultAppStateManager.m @@ -23,9 +23,9 @@ @interface SentryDefaultAppStateManager () @implementation SentryDefaultAppStateManager -- (instancetype)initWithOptions:(SentryOptions *)options +- (instancetype)initWithOptions:(SentryOptions *_Nullable)options crashWrapper:(SentryCrashWrapper *)crashWrapper - fileManager:(SentryFileManager *)fileManager + fileManager:(SentryFileManager *_Nullable)fileManager dispatchQueueWrapper:(SentryDispatchQueueWrapper *)dispatchQueueWrapper notificationCenterWrapper:(id)notificationCenterWrapper { diff --git a/Sources/Sentry/SentryDependencyContainer.m b/Sources/Sentry/SentryDependencyContainer.m index c3ff879c7a9..c0f809285e7 100644 --- a/Sources/Sentry/SentryDependencyContainer.m +++ b/Sources/Sentry/SentryDependencyContainer.m @@ -387,7 +387,8 @@ - (SentryMXManager *)metricKitManager SENTRY_THREAD_SANITIZER_DOUBLE_CHECKED_LOC #endif // SENTRY_HAS_METRIC_KIT -- (SentryScopePersistentStore *)scopePersistentStore SENTRY_THREAD_SANITIZER_DOUBLE_CHECKED_LOCK +- (SentryScopePersistentStore *_Nullable) + scopePersistentStore SENTRY_THREAD_SANITIZER_DOUBLE_CHECKED_LOCK { SENTRY_LAZY_INIT(_scopePersistentStore, [[SentryScopePersistentStore alloc] initWithFileManager:self.fileManager]); diff --git a/Sources/Sentry/SentryFileManagerHelper.m b/Sources/Sentry/SentryFileManagerHelper.m index 2a9b5eee46c..c70e35d9ba2 100644 --- a/Sources/Sentry/SentryFileManagerHelper.m +++ b/Sources/Sentry/SentryFileManagerHelper.m @@ -103,7 +103,7 @@ @interface SentryFileManagerHelper () @implementation SentryFileManagerHelper -- (nullable instancetype)initWithOptions:(SentryOptions *)options error:(NSError **)error +- (nullable instancetype)initWithOptions:(SentryOptions *_Nullable)options error:(NSError **)error { if (self = [super init]) { [self createPathsWithOptions:options]; @@ -128,7 +128,7 @@ - (nullable instancetype)initWithOptions:(SentryOptions *)options error:(NSError return self; } -- (void)createPathsWithOptions:(SentryOptions *)options +- (void)createPathsWithOptions:(SentryOptions *_Nullable)options { NSString *cachePath = options.cacheDirectoryPath; diff --git a/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h b/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h index 0564ea4474d..3a18667a387 100644 --- a/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h +++ b/Sources/Sentry/include/HybridPublic/SentryDependencyContainer.h @@ -103,7 +103,7 @@ SENTRY_NO_INIT @property (nonatomic, strong, readonly) SentryThreadInspector *threadInspector; @property (nonatomic, strong, readonly) SentryFileIOTracker *fileIOTracker; @property (nonatomic, strong) SentryCrashSwift *crashReporter; -@property (nonatomic, strong) SentryScopePersistentStore *scopePersistentStore; +@property (nonatomic, strong, nullable) SentryScopePersistentStore *scopePersistentStore; @property (nonatomic, strong) SentryDebugImageProvider *debugImageProvider; - (id)getANRTracker:(NSTimeInterval)timeout; diff --git a/Sources/Sentry/include/SentryDefaultAppStateManager.h b/Sources/Sentry/include/SentryDefaultAppStateManager.h index 31afabc4fa8..6e3dda9eec5 100644 --- a/Sources/Sentry/include/SentryDefaultAppStateManager.h +++ b/Sources/Sentry/include/SentryDefaultAppStateManager.h @@ -15,9 +15,9 @@ SENTRY_NO_INIT @property (nonatomic, readonly) NSInteger startCount; -- (instancetype)initWithOptions:(SentryOptions *)options +- (instancetype)initWithOptions:(SentryOptions *_Nullable)options crashWrapper:(SentryCrashWrapper *)crashWrapper - fileManager:(SentryFileManager *)fileManager + fileManager:(SentryFileManager *_Nullable)fileManager dispatchQueueWrapper:(SentryDispatchQueueWrapper *)dispatchQueueWrapper notificationCenterWrapper:(id)notificationCenterWrapper; diff --git a/Sources/Sentry/include/SentryFileManagerHelper.h b/Sources/Sentry/include/SentryFileManagerHelper.h index d7fb2b1f02f..39a0b00bdc4 100644 --- a/Sources/Sentry/include/SentryFileManagerHelper.h +++ b/Sources/Sentry/include/SentryFileManagerHelper.h @@ -33,7 +33,7 @@ SENTRY_NO_INIT @property (nonatomic, copy, nullable) void (^handleEnvelopesLimit)(void); -- (nullable instancetype)initWithOptions:(SentryOptions *)options +- (nullable instancetype)initWithOptions:(SentryOptions *_Nullable)options error:(NSError **)error NS_DESIGNATED_INITIALIZER; #pragma mark - Envelope diff --git a/Sources/Sentry/include/SentryWatchdogTerminationBreadcrumbProcessor.h b/Sources/Sentry/include/SentryWatchdogTerminationBreadcrumbProcessor.h index ccbdf07d3d4..fc8d9bae052 100644 --- a/Sources/Sentry/include/SentryWatchdogTerminationBreadcrumbProcessor.h +++ b/Sources/Sentry/include/SentryWatchdogTerminationBreadcrumbProcessor.h @@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN @interface SentryWatchdogTerminationBreadcrumbProcessor : NSObject - (instancetype)initWithMaxBreadcrumbs:(NSInteger)maxBreadcrumbs - fileManager:(SentryFileManager *)fileManager; + fileManager:(SentryFileManager *_Nullable)fileManager; - (void)addSerializedBreadcrumb:(NSDictionary *)crumb; diff --git a/Sources/Swift/Helper/SentryFileManager.swift b/Sources/Swift/Helper/SentryFileManager.swift index 7499262eb17..79b9119c8a4 100644 --- a/Sources/Swift/Helper/SentryFileManager.swift +++ b/Sources/Swift/Helper/SentryFileManager.swift @@ -26,7 +26,7 @@ helper.previousBreadcrumbsFilePathTwo } - @objc public init(options: Options, dateProvider: SentryCurrentDateProvider, dispatchQueueWrapper: SentryDispatchQueueWrapper) throws { + @objc public init(options: Options?, dateProvider: SentryCurrentDateProvider, dispatchQueueWrapper: SentryDispatchQueueWrapper) throws { dispatchQueue = dispatchQueueWrapper self.dateProvider = dateProvider helper = try SentryFileManagerHelper(options: options) diff --git a/Sources/Swift/Integrations/WatchdogTerminations/Processors/SentryWatchdogTerminationAttributesProcessor.swift b/Sources/Swift/Integrations/WatchdogTerminations/Processors/SentryWatchdogTerminationAttributesProcessor.swift index 4cd3982d32c..f7eb1ecf84a 100644 --- a/Sources/Swift/Integrations/WatchdogTerminations/Processors/SentryWatchdogTerminationAttributesProcessor.swift +++ b/Sources/Swift/Integrations/WatchdogTerminations/Processors/SentryWatchdogTerminationAttributesProcessor.swift @@ -5,11 +5,11 @@ import Foundation @_spi(Private) public class SentryWatchdogTerminationAttributesProcessor: NSObject { private let dispatchQueueWrapper: SentryDispatchQueueWrapper - private let scopePersistentStore: SentryScopePersistentStore + private let scopePersistentStore: SentryScopePersistentStore? public init( withDispatchQueueWrapper dispatchQueueWrapper: SentryDispatchQueueWrapper, - scopePersistentStore: SentryScopePersistentStore + scopePersistentStore: SentryScopePersistentStore? ) { self.dispatchQueueWrapper = dispatchQueueWrapper self.scopePersistentStore = scopePersistentStore @@ -21,48 +21,48 @@ import Foundation public func clear() { SentrySDKLog.debug("Deleting all stored data in in persistent store") - scopePersistentStore.deleteAllCurrentState() + scopePersistentStore?.deleteAllCurrentState() } public func setContext(_ context: [String: [String: Any]]?) { setData(data: context, field: .context) { [weak self] data in - self?.scopePersistentStore.writeContextToDisk(context: data) + self?.scopePersistentStore?.writeContextToDisk(context: data) } } public func setUser(_ user: User?) { setData(data: user, field: .user) { [weak self] data in - self?.scopePersistentStore.writeUserToDisk(user: data) + self?.scopePersistentStore?.writeUserToDisk(user: data) } } public func setDist(_ dist: String?) { setData(data: dist, field: .dist) { [weak self] data in - self?.scopePersistentStore.writeDistToDisk(dist: data) + self?.scopePersistentStore?.writeDistToDisk(dist: data) } } public func setEnvironment(_ environment: String?) { setData(data: environment, field: .environment) { [weak self] data in - self?.scopePersistentStore.writeEnvironmentToDisk(environment: data) + self?.scopePersistentStore?.writeEnvironmentToDisk(environment: data) } } public func setTags(_ tags: [String: String]?) { setData(data: tags, field: .tags) { [weak self] data in - self?.scopePersistentStore.writeTagsToDisk(tags: data) + self?.scopePersistentStore?.writeTagsToDisk(tags: data) } } public func setExtras(_ extras: [String: Any]?) { setData(data: extras, field: .extras) { [weak self] data in - self?.scopePersistentStore.writeExtrasToDisk(extras: data) + self?.scopePersistentStore?.writeExtrasToDisk(extras: data) } } public func setFingerprint(_ fingerprint: [String]?) { setData(data: fingerprint, field: .fingerprint) { [weak self] data in - self?.scopePersistentStore.writeFingerprintToDisk(fingerprint: data) + self?.scopePersistentStore?.writeFingerprintToDisk(fingerprint: data) } } @@ -76,7 +76,7 @@ import Foundation } guard let data = data else { SentrySDKLog.debug("Data for \(field.name) is nil, deleting active file.") - strongSelf.scopePersistentStore.deleteCurrentFieldOnDisk(field: field) + strongSelf.scopePersistentStore?.deleteCurrentFieldOnDisk(field: field) return } save(data)