[해결방법] error: stored properties cannot be marked potentially unavailable with '@available' @available(iOS 14.0, *)

flutter_inappwebview 라이브러리를 사용하다 아래와 같은 에러가 발생했어요.

swift 파일에서 발생한 문법에러 인듯한데

public class UserScript : WKUserScript {
    var groupName: String?
    @available(iOS 14.0, *) // <- 에러
    lazy var contentWorld: WKContentWorld = WKContentWorld.page
    
    public override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) {
        super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: forMainFrameOnly)
    }
    
    public init(groupName: String?, source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool) {
        super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: forMainFrameOnly)
        self.groupName = groupName
    }
    
    @available(iOS 14.0, *)
    public override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool, in contentWorld: WKContentWorld) {
        super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: forMainFrameOnly, in: contentWorld)
        self.contentWorld = contentWorld
    }

    @available(iOS 14.0, *)
    public init(groupName: String?, source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool, in contentWorld: WKContentWorld) {
        super.init(source: source, injectionTime: injectionTime, forMainFrameOnly: forMainFrameOnly, in: contentWorld)
        self.groupName = groupName
        self.contentWorld = contentWorld
    }
    
    . . .
    
}

 

문제 해결방법은 최신버전으로 받으면 끝

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.4
 
  flutter_inappwebview: ^5.5.0+3   << 최신버전으로 수정

 

728x90