I'm implementing Google Admob on Flutter using this tutorial for general steps, then and then this tutorial for a specific tutorial on GADNativeAdView
. The tutorial shows about how developers should:
.xib
file.IBOutlet
s of GADNativeAdView
.But when I arrived to step 4, I'm confused because I don't see any outlets on GADNativeAdView
. When I open the source code of GADNativeAd.h
containing GADNativeAdView
, I see clearly that the interface GADNativeAdView
obviously contains outlets. But it doesn't show on the Inspectors. How can I do this?
After much looking around, I arrive at this comment on this answer to this question, which points to a google group discussion about the same thing in 2021. In a reply, Google developer said that they're aware of this issue, which is basically Apple's problem, and there's nothing they can do about it except wait for Apple to fix it. Read the whole thread for the entire story.
But to work around this issue, here are the steps:
GADNativeAdView
, which is GADNativeAd.h
.GADNativeAdCopy.h
.GADNativeAdCopy.h
into bridging header.IBOutlet
s of GADNativeAdView
will automatically appear on Inspectors when you click on the view.GADNativeAdCopy.h
from the bridging header import statement. --> you need to do this otherwise your project won't compile..xib
GADNativeAdView
view will still retain its outlets even after you remove the import statement. (the import statement only needed to make the outlets appear, so if the other unconnected outlets suddenly disappear, just re-add the bridging header import)Note: You will still need to import google_mobile_ads
on ListTileNativeAdFactory.swift
.
This is a Question and Answer post to let other users know the solution, because the right search results don't appear easily when I scoured the web earlier.