Eric Johansson
Eric Johansson

Reputation: 41

Unity Game will not build with GoogleMobileAds

I have been trying to build my game to iOS for quite some time now but whenever I try to build the project with GoogleMobileAds it won't work. The ads work fine on android but not on iOS. If i remove the GoogleMobileAds completely the project builds fine but not with the ads.

I have followed the documentation to the best of my ability but I just can't seem to get it to work. In the documentation it says that after building the Xcode project in Unity you should also get a Cocoapods workspace file but it doesn't seem to show up. What could I be doing wrong?

Thank you for any help you might give.

Upvotes: 1

Views: 1579

Answers (1)

Eric Johansson
Eric Johansson

Reputation: 41

If any one happens to stumble upon this later and have the same problem. Here is how i solved it:

Unity would not generate a podfile for me like it says it should in the developer guide, maybe I haven't installed Cocoapods correctly. Regardless, in the end, the fix was quite easy.

  • I manually downloaded the Google Mobile Ads SDK and added it to the Frameworks folder in the Xcode project. (If you are more experienced with xcode/cocoapods than I am you could probably just write your own podfile that would do this for you)
  • Then I changed "Enable Modules (C and Objective-C)" to Yes in the Build Settings
  • Lastly I added "$(inherited)" to "Other Linker Flags"

After this everything compiled like it should and the ads worked fine.

Upvotes: 1

Related Questions