firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.68k stars 3.97k forks source link

[firebase_admob] Native Ads support documentation for Swift #2257

Closed ahsanalidev closed 3 years ago

ahsanalidev commented 4 years ago

Documentation for implementing Native adds with AppDelegate.swift rather then AppDelegate.m file.

  1. Converted this code
    
    @interface NativeAdFactoryExample : NSObject<FLTNativeAdFactory>
    @end

@implementation NativeAdFactoryExample

Expected behavior Better documentation for adding native ads with swift or AppDelegate.swift

Additional context I will be really grateful if some body help me out. Thanks in advance.

caseta commented 4 years ago

I am having similar troubles.

I am trying to use firebase_admob: ^0.9.3+2. The documentation is not specific enough / is in Objective-C. I'm having compile time errors for iOS, but I'm not even trying to use Native Ads, only banner ads. Here is what I get when trying to build:

    In file included from /Users/administrator/Library/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/ios/Classes/FLTRequestFactory.m:6:
    /Users/administrator/Library/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/ios/Classes/FLTFirebaseAdMobPlugin.h:28:4: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
       ^
    /Users/administrator/Library/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/ios/Classes/FLTFirebaseAdMobPlugin.h:28:45: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
                                                ^
    2 errors generated.
ahsanalidev commented 4 years ago

I am having similar troubles.

I am trying to use firebase_admob: ^0.9.3+2. The documentation is not specific enough / is in Objective-C. I'm having compile time errors for iOS, but I'm not even trying to use Native Ads, only banner ads. Here is what I get when trying to build:

    In file included from /Users/administrator/Library/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/ios/Classes/FLTRequestFactory.m:6:
    /Users/administrator/Library/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/ios/Classes/FLTFirebaseAdMobPlugin.h:28:4: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
       ^
    /Users/administrator/Library/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_admob-0.9.3+2/ios/Classes/FLTFirebaseAdMobPlugin.h:28:45: error: expected a type
    - (GADUnifiedNativeAdView *)createNativeAd:(GADUnifiedNativeAd *)nativeAd
                                                ^
    2 errors generated.

For Banner Ads you don't need to specify anything in the AppDelegate file just use it directly inside your flutter app it will work.

jpvanmuijen commented 4 years ago

Did anyone find any solution, documentation or tutorial yet?

ahsanalidev commented 4 years ago

I tried to implement the native ads but later found out they act just like banner ads and I wanted to implement them in list view. I found a plugin in pub.dev. https://pub.dev/packages/native_ads and implemented ads with that.

russellwheatley commented 3 years ago

The firebase_admob plugin will be deprecated in April 2021 in favor of Google Mobile Ads SDK for Flutter. Google Mobile Ads SDK for Flutter is a new Flutter plugin that supports more Ads formats than firebase_admob does. Google Mobile Ads SDK for Flutter currently supports loading and displaying banner, interstitial (full-screen), native ads, and rewarded video ads across AdMob and AdManager. It also supports displaying banner and native ads as Widgets as opposed to being overlayed over all app content. We're now recommending projects currently using firebase_admob migrate to Google Mobile Ads SDK for Flutter following the instructions outlined here. Issues with migrating or with using the new package should now be raised over on the Google Mobile Ads SDK for Flutter repository.