Gautham Elango
Gautham Elango

Reputation: 363

How do I integrate AdMob into an iOS app? Other tutorials do not seem to work with the latest updates

I am trying to integrate Google`s AdMob into my iOS app, using Xcode 7.2, Swift 2.0, and iOS 9.2. I followed the official tutorial on this: https://developers.google.com/admob/ios/quick-start; and I have tried both methods: the streamlined method with CocoaPods, and manually using the SDK download.

In the streamlined method, I had a lot of trouble with CocoaPods, which nearly destroyed my entire Xcode project. This experience made me never use CocoaPods again. Unless you know a lot on CocoaPods, do not ask me to use them.

In the manual method, I am unable to import the framework into my code, although it is imported already into the project. I get the error: No such module 'GoogleMobileAds'. The framework is visible in the Project Navigator with other frameworks, in the Linked Frameworks and Libraries with other frameworks.

Due to this I am unable to use all of the code listed in the tutorial, and I have no code to show. If you are looking for any code related to integrating AdMob, it is in the tutorial. Please note I am a beginner in Swift, and I have no knowledge in Objective-C. Thanks.

import GoogleMobileAds

Upvotes: 1

Views: 6603

Answers (2)

Gautham Elango
Gautham Elango

Reputation: 363

Figured out the solution myself. I noticed that in the tutorial, there was an important section I promptly ignored:

Add other frameworks that the SDK requires
The SDK depends on the following iOS development frameworks which may not already be part of your project:
AdSupport
AudioToolbox
AVFoundation
CoreGraphics
CoreMedia
CoreTelephony
EventKit
EventKitUI
MediaPlayer
MessageUI
StoreKit
SystemConfiguration

You must make sure these frameworks are already part of the project, since Admob depends on them. If anyone else is having similar issues as described above, try this, or read the tutorial carefully.

Upvotes: 2

viratpuar
viratpuar

Reputation: 554

There are two steps to solve your problem:

Put the path of GoogleMobileAds.framework in Targets -> Build Settings "Framework Search Path"

Set "No" under Project -> Build Settings -> Enable Bitcode

refer this Link

Upvotes: 0

Related Questions