2021年4月23日星期五

cannot convert value of type 'OSLogMessage' to expected dictionary key type 'AnyHashable'when implementing youtubeioshelper in swiftUI

I searched a quite a long time for the answer but didn't get much helpful advice, here is my code:

struct testdate: View {            var body: some View {       YTWrapper(videoID: "jQtP1dD6jQ0")                  .frame(width: 300, height: 200, alignment: center)        }    }  struct YTWrapper : UIViewRepresentable {      var videoID : String            func makeUIView(context: Context) -> YTPlayerView {                    let playerView = YTPlayerView()          playerView.load(withVideoId: videoID,playerVars: ["playInline" : 1])          return playerView      }            func updateUIView(_ uiView: YTPlayerView, context: Context) {                }  }    

I get an error info: Compiling failed: cannot convert value of type 'OSLogMessage' to expected dictionary key type 'AnyHashable' , if I delete playerVars: ["playInline" : 1], then it is ok but always enters a full screen when playing. What I need is to make it plays inline

https://stackoverflow.com/questions/67238946/cannot-convert-value-of-type-oslogmessage-to-expected-dictionary-key-type-any April 24, 2021 at 10:59AM

没有评论:

发表评论