Admob problems with IOS build
Hi all.
I have been experiencing problems with Admob in a 2D game in Unity. To simplify the issue, I created a new project with nothing but a basic script attached to main camera as follows:
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class AdMobScript : MonoBehaviour {
void Start()
{
RequestBanner();
}
private void RequestBanner()
{
#if UNITY_ANDROID
string adUnitId = "<my android adunitid goes here>";
#elif UNITY_IPHONE
string adUnitId = "<my ios adunitid goes here>";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.TopRight);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
}
This is actually the basic example script given here: link text
except I change my adunitids with proper values while testing the script.
When I build the project for IOS, I get the following error:
Could not create a new Xcode project with CocoaPods: Encountered unexpected error while running pod
UnityEngine.Debug:LogWarning(Object)
GoogleMobileAds.Postprocessor:RunPodUpdate(String) (at Assets/GoogleMobileAds/Editor/PostProcessor.cs:60)
GoogleMobileAds.Postprocessor:OnPostprocessBuild(BuildTarget, String) (at Assets/GoogleMobileAds/Editor/PostProcessor.cs:27)
My Unity version is 5.3.6f1 Personal, Android Studio 2.1.2, Google Mobile Ads Unity Plugin v3.0.5 and on my console I get resolver version is 10102.
Upgrading Unity to 5.4.0f3 corrupted my project so that is not an option for now.
How can I debug this problem from here?
Answer by aykut-yilmaz · Jan 20, 2017 at 05:55 AM
With the new Unity version 5.5.0f3, this problem disappeared. I can build on a Windows 10 PC and move the build to a Mac and compile with no problems. I can also build on a Mac and compile on it. Thanks for all the help and ideas.
Answer by jahester · Oct 07, 2016 at 01:54 AM
@aykut-yilmaz, I'm getting the exact same error as you with 5.4.0f3. I'm using the official Google-developed Unity AdMob plugin. The project builds fine for Android and I already have a beta build in the Google Play store. Were you able to resolve the issue?
Answer by aykut-yilmaz · Oct 08, 2016 at 12:35 PM
Unfortunately I haven't been able to resolve this yet. I upgraded some software, Android Build Tools to 24.0.1, Java to 1.8 (8u101), Android Studio to 2.1.3 and Gradle to 2.14.1. Those didn't help either.
@aykut-yilmaz, I think I've solved it, at least for my situation. I'm doing my primary development on a Windows 10 PC. I thought I would be able to do an iOS build on the PC and copy the resulting Xcode project to a $$anonymous$$ac. Apparently the CocoaPods mentioned in the error is a library manager baked into $$anonymous$$ac OS X. As a workaround, I installed Unity on the $$anonymous$$ac and copied the entire Unity project from the PC, except the Library folder as noted here:
http://answers.unity3d.com/questions/1100270/transferingmoving-files-from-windows-to-mac.html
I was able to do an iOS build from Unity on the $$anonymous$$ac without the CocoaPods error. I'm getting a signing error when I try to build the project in xCode, but I think that's probably because this is the 1st time I've used xCode and I haven't set up something correctly.
I am also using Windows 10 as my development platform. I will try to test it on a $$anonymous$$ac when I have the possibility. Thanks for the help.
We had the same workflow in our office: Windows 10 dev machine > building for iOS/Android > copying the xcode project to the $$anonymous$$ac and build there. Sadly it's not possible to build for iOS on Windows 10 anymore, since it needs the CocoaPods (for Admob), which is an OSX thingy.
Doing it all on the $$anonymous$$ac still works, although it's an extra effort and expense... All we had to do on the $$anonymous$$ac: $ sudo gem install cocoapods
Your answer
Follow this Question
Related Questions
AdMob plugin in iOS: 'The type or namespace name 'Google' could not be found.' 0 Answers
How to use Native Audio Plugin SDK in iOS 0 Answers
texture rendering issue on iOS using OpenGL ES in Unity project 0 Answers
Admob Unity Plugin - Mute interstitial ads 1 Answer
Admob problems with Android build 2 Answers