diff --git a/Sources/LittleBlueTooth/Classes/Model/LittleBlueToothCharacteristic.swift b/Sources/LittleBlueTooth/Classes/Model/LittleBlueToothCharacteristic.swift index 7dbf0fb..26ea8d9 100644 --- a/Sources/LittleBlueTooth/Classes/Model/LittleBlueToothCharacteristic.swift +++ b/Sources/LittleBlueTooth/Classes/Model/LittleBlueToothCharacteristic.swift @@ -49,7 +49,11 @@ public struct LittleBlueToothCharacteristic: Identifiable { /// - returns: An instance of `LittleBlueToothCharacteristic`. public init(with characteristic: CBCharacteristic) { // Couldn't get rid of this orrible compiler flags but it is present to make work SPM build and Xcode build -#if (TEST || Xcode) && swift(>=5.5) && !targetEnvironment(macCatalyst) +#if TEST + guard let service = characteristic.service else { + fatalError("There must be a service associated to the characteristic") + } +#elseif ((os(iOS) && !targetEnvironment(macCatalyst)) || os(tvOS) || os(watchOS)) && swift(>=5.5) guard let service = characteristic.service else { fatalError("There must be a service associated to the characteristic") }