duyduong / flutter_native_admob

Plugin to integrate native firebase admob to Flutter application
MIT License
62 stars 85 forks source link

iOS build failed with Flutter 2 #87

Closed QuentinSc closed 3 years ago

QuentinSc commented 3 years ago

Hello!

Just upgrade my app to Flutter 2

`Launching lib/main.dart on iPhone 11 in debug mode... lib/main.dart Xcode build done. 155,2s Failed to build iOS app Error output from Xcode build: ↳ BUILD FAILED Xcode's output: ↳ 2 warnings generated. 1 warning generated. /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:25:28: error: cannot find type 'GADUnifiedNativeAd' in scope var nativeAdChanged: ((GADUnifiedNativeAd?) -> Void)? ^~~~~~ /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:26:19: error: cannot find type 'GADUnifiedNativeAd' in scope var nativeAd: GADUnifiedNativeAd? { ^~~~~~ /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:108:34: error: cannot find type 'GADUnifiedNativeAdLoaderDelegate' in scope extension NativeAdmobController: GADUnifiedNativeAdLoaderDelegate { ^~~~~~~~ /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_nativeadmob-2.1.0+3/ios/Classes/NativeAdmobController.swift:110:79: error: cannot find type 'GADRequestError' in scope func adLoader( adLoader: GADAdLoader, didFailToReceiveAdWithError error: GADRequestError) { ^~~~~~~ /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_nativeadmob-2.1.0+3/ios/Classes/NativeAdmobController.swift:115:65: error: cannot find type 'GADUnifiedNativeAd' in scope func adLoader( adLoader: GADAdLoader, didReceive nativeAd: GADUnifiedNativeAd) { ^~~~~~ /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:56:30: warning: comparing non-optional value of type 'Int' to 'nil' always returns true if numberAds != nil && numberAds > 1 {


    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:62:32: error: type 'Array<GADAdLoaderAdType>.ArrayLiteralElement' (aka 'GADAdLoaderAdType') has no member 'unifiedNative'
                        adTypes: [.unifiedNative],
                                  ~^~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:65:38: error: cannot assign value of type 'NativeAdmobController' to type 'GADAdLoaderDelegate?'
                    adLoader?.delegate = self
                                         ^~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:65:38: note: add missing conformance to 'GADAdLoaderDelegate' to class 'NativeAdmobController'
                    adLoader?.delegate = self
                                         ^
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:15:21: error: cannot find type 'GADUnifiedNativeAdView' in scope
    class NativeAdView: GADUnifiedNativeAdView {
                        ^~~~~~~~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:116:34: error: cannot find type 'GADUnifiedNativeAd' in scope
        func setNativeAd(_ nativeAd: GADUnifiedNativeAd?) {
                                     ^~~~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:108:9: error: 'super' members cannot be referenced in a root class
            super.init(frame: frame)
            ^
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:169:9: error: cannot find 'layoutIfNeeded' in scope
            layoutIfNeeded()
            ^~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:176:14: error: value of type 'NativeAdView' has no member 'mediaView'
            self.mediaView = adMediaView
            ~~~~ ^~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:177:14: error: value of type 'NativeAdView' has no member 'headlineView'
            self.headlineView = adHeadLineLbl
            ~~~~ ^~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:178:14: error: value of type 'NativeAdView' has no member 'callToActionView'
            self.callToActionView = callToActionBtn
            ~~~~ ^~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:179:14: error: value of type 'NativeAdView' has no member 'iconView'
            self.iconView = adIconView
            ~~~~ ^~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:180:14: error: value of type 'NativeAdView' has no member 'bodyView'
            self.bodyView = adBodyLbl
            ~~~~ ^~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:181:14: error: value of type 'NativeAdView' has no member 'storeView'
            self.storeView = adStoreLbl
            ~~~~ ^~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:182:14: error: value of type 'NativeAdView' has no member 'priceView'
            self.priceView = adPriceLbl
            ~~~~ ^~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:183:14: error: value of type 'NativeAdView' has no member 'starRatingView'
            self.starRatingView = adRatingView
            ~~~~ ^~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:184:14: error: value of type 'NativeAdView' has no member 'advertiserView'
            self.advertiserView = adAdvertiserLbl
            ~~~~ ^~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:221:9: error: cannot find 'addSubview' in scope
            addSubview(adLabelView)
            ^~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:226:9: error: cannot find 'addSubview' in scope
            addSubview(contentView)
            ^~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:254:9: error: cannot find 'addSubview' in scope
            addSubview(adLabelView)
            ^~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:259:9: error: cannot find 'addSubview' in scope
            addSubview(contentView)
            ^~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:15:21: error: cannot find type 'GADUnifiedNativeAdView' in scope
    class NativeAdView: GADUnifiedNativeAdView {
                        ^~~~~~~~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:25:28: error: cannot find type 'GADUnifiedNativeAd' in scope
        var nativeAdChanged: ((GADUnifiedNativeAd?) -> Void)?
                               ^~~~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdViews/NativeAdView.swift:116:34: error: cannot find type 'GADUnifiedNativeAd' in scope
        func setNativeAd(_ nativeAd: GADUnifiedNativeAd?) {
                                     ^~~~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/NativeAdmobController.swift:26:19: error: cannot find type 'GADUnifiedNativeAd' in scope
        var nativeAd: GADUnifiedNativeAd? {
                      ^~~~~~~~~~~~~~~~~~
    /Users/quentinsc/.pub-cache/hosted/pub.dartlang.org/flutter_native_admob-2.1.0+3/ios/Classes/SwiftFlutterNativeAdmobPlugin.swift:109:16: error: cannot convert return expression of type 'NativeAdView' to return type 'UIView'
            return nativeAdView
                   ^~~~~~~~~~~~
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description
Could not build the application for the simulator.
Error launching application on iPhone 11.
Exited (sigterm)
`
QuentinSc commented 3 years ago

Duplicate of #83