Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google AdMob 7 integration with cocoapods

I have spent hours on this and still no luck.

I have a library (which is a pod) and it's using Google AdMob 7 as a dependency, let's say that it's named MyLib

Now when I want to add pod 'MyLib' to project A, it'll install it alongside its dependencies which include Google AdMob 7.

The problem is: When I test the library project which contains its source files, it works just fine but when I compile project A, it doesn't compile and it gives me a compiler error on the import line

@import GoogleMobileAds;

which is in the MyLib source files.

To make it simpler

Project -> Contains a pod I wrote which is MyLib -> Using AdMob 7 as a pod

Any idea why it's happening?

EDIT:

If anyone is interested, the same now happens with Google maps after they converted it to a Framework

like image 388
Boda Avatar asked Mar 18 '23 00:03

Boda


1 Answers

If anyone is interested or faced this problem, I know now why my end-point application couldn't notice the existence of Google Ad Mob pod inside my own pod.

I should have used spec.ios.vendored_frameworks in my pod spec cause now Google AdMob SDK and Maps SDK for iOS are provided as Frameworks in cocoapods so simply I added this to my pod spec for the library I wrote:

s.ios.vendored_frameworks = 'Pods/Google-Maps-iOS-SDK/GoogleMaps.framework', 'Pods/Google-Mobile-Ads-SDK/GoogleMobileAdsSdkiOS-7.0.0/GoogleMobileAds.framework'
like image 66
Boda Avatar answered Mar 24 '23 21:03

Boda