2626 */
2727
2828import Foundation
29+ import OneSignalCore
2930
3031@objc
3132public protocol OSBackgroundTaskManagerDelegate {
@@ -39,12 +40,12 @@ public protocol OSBackgroundTaskManagerDelegate {
3940// check if Core needs to use this, then ok to live here
4041@objc
4142public class OSBackgroundTaskManager : NSObject {
42- @objc public static weak var delegate : OSBackgroundTaskManagerDelegate ?
43+ @objc public static var delegate : OSBackgroundTaskManagerDelegate ? // TODO: This used to be weak, is that still necessary
4344
4445 @objc
4546 public static func beginBackgroundTask( _ taskIdentifier: String ) {
4647 guard let delegate = delegate else {
47- // Log error, no delegate
48+ OneSignalLog . onesignalLog ( . LL_ERROR , message : " OSBackgroundTaskManager:beginBackgroundTask \( taskIdentifier ) cannot be executed due to no delegate. " )
4849 return
4950 }
5051 delegate. beginBackgroundTask ( taskIdentifier)
@@ -53,7 +54,7 @@ public class OSBackgroundTaskManager: NSObject {
5354 @objc
5455 public static func endBackgroundTask( _ taskIdentifier: String ) {
5556 guard let delegate = delegate else {
56- // Log error, no delegate
57+ OneSignalLog . onesignalLog ( . LL_ERROR , message : " OSBackgroundTaskManager:endBackgroundTask \( taskIdentifier ) cannot be executed due to no delegate. " )
5758 return
5859 }
5960 delegate. endBackgroundTask ( taskIdentifier)
@@ -62,7 +63,7 @@ public class OSBackgroundTaskManager: NSObject {
6263 @objc
6364 public static func setTaskInvalid( _ taskIdentifier: String ) {
6465 guard let delegate = delegate else {
65- // Log error, no delegate
66+ OneSignalLog . onesignalLog ( . LL_ERROR , message : " OSBackgroundTaskManager:setTaskInvalid \( taskIdentifier ) cannot be executed due to no delegate. " )
6667 // But not necessarily an error because this task won't exist
6768 // Can be called in initialization of services before delegate is set
6869 return
0 commit comments