sarbagyastha / youtube_player_flutter

A Flutter plugin for inline playback or streaming of YouTube videos using the official iFrame Player API.
https://youtube.sarbagyastha.com.np
BSD 3-Clause "New" or "Revised" License
710 stars 823 forks source link

[BUG] Swift Compiler Error on iOS devices #475

Closed juria closed 3 years ago

juria commented 3 years ago

Describe the bug After updating this package to version 8.0.0 it is not possible to compile my app on iOS devices.

To Reproduce Add dependency youtube_player_flutter: ^8.0.0 to pubspec.yaml and try to run your Flutter app on an iOS device. I used debug mode and tried on simulated devices and on a real device.

No problems on Android. Previously I already used youtube_player_flutter: ^7.0.0+7and had no problems on both platforms (iOS and Android).

Expected behavior The app should start and all functionality should be like on version 7.0.0+7 (but null-safe).

Technical Details:

Additional context Version 8.0.0 is necessary to migrate your Flutter app to full sound null-safety. That's why it is no possibility for me to use version 7.0.0+7 in the future.

Error logs:

Launching lib/main.dart on iPhone 6s Plus in debug mode...
Running Xcode build...
Xcode build done.                                           74,1s
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **

Xcode's output:
↳
    /Users/John/develop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.0/ios/Classes/Types/UserScript.swift:26:125: error: use of undeclared type 'WKContentWorld'
        public override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool, in contentWorld: WKContentWorld) {
                                                                                          ^~~~~~~~~~~~~~
    /Users/John/develop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.0/ios/Classes/Types/UserScript.swift:32:136: error: use of undeclared type 'WKContentWorld'
        public init(groupName: String?, source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool, in contentWorld: WKContentWorld) {
                                                                                          ^~~~~~~~~~~~~~
    /Users/John/develop/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.3.0/ios/Classes/Types/PluginScript.swift:26:125: error: use of undeclared type 'WKContentWorld'
        public override init(source: String, injectionTime: WKUserScriptInjectionTime, forMainFrameOnly: Bool, in contentWorld: WKContentWorld) {

        (...)

        warning: Could not read serialized diagnostics file: Invalid File: Invalid diagnostics signature (in target 'flutter_inappwebview' from projects 'Pods')

        (...)

(The original error logs are much longer, but all messages are similar and not clear to me.)

juria commented 3 years ago

Probably the error happens because of the nested package flutter_inappwebview. I found a similar issue there: https://github.com/pichillilorenzo/flutter_inappwebview/issues/779

The solution there was to update XCode. I'll try this (next tuesday) and if it fixes my error, I will close this issue here.

juria commented 3 years ago

Updating XCode to version 12.4 fixed the error.