Admob integration into Xcode Project built in Unity - NSURLSession/NSURLConnection HTTP load failed

186 views
Skip to first unread message

Kristan Halls

unread,
Mar 4, 2017, 3:11:29 AM3/4/17
to Google Mobile Ads SDK Developers
I am trying to integrate Admob and also Firebase into a Xcode (8.2.1) project that was exported from Unity (5.6b).

My podfile


platform :ios, ‘9.0’

target ‘my_app do
  pod 'Firebase/Core'
  pod 'Firebase/AdMob'
end

All ok frameworks are added.

Ive included my GoogleService-Info.plist

In my UnityAppCrontroller i have

#import "FirebaseCore/FirebaseCore.h"//;

#import "FirebaseAnalytics/FirebaseAnalytics.h"//;

#import "Firebase/Firebase.h"//;

#import "GoogleMobileAds/GoogleMobileAds.h"//;


- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions

{

::printf("-> applicationDidFinishLaunching()\n");

[FIRApp configure];

    [GADMobileAds configureWithApplicationID:@"ca-app-pub-******"];



and in my viewController i have


@implementation UnityPortraitOnlyViewController

- (NSUInteger)supportedInterfaceOrientations

{

return 1 << UIInterfaceOrientationPortrait;

}

- (void)viewWillAppear:(BOOL)animated

{

[GetAppController() updateAppOrientation:UIInterfaceOrientationPortrait];

[super viewWillAppear:animated];

    GADBannerView *adView = [[GADBannerView allocinitWithAdSize:kGADAdSizeBanner];

     adView.rootViewController = self;

      adView.adUnitID = @"ca-app-pub-********/4839119450";

    GADRequest *request = [GADRequest request];

    request.testDevices = @[ kGADSimulatorID ];

    request.testDevices = @[ @"e4022a2432e3186717781c4cf08318d0" ];


    ///   // Place the ad view onto the screen.

    [self.view addSubview:adView];

    ///   // Request an ad without any additional targeting information.

    [adView loadRequest:request];

    // [adView loadRequest:[GADRequest request]];

     }

- (void)adViewDidReceiveAd:(GADBannerView *)adView {

    [self.view addSubview:adView];

    adView.hidden = NO;

    NSLog@"Google ad shown");

}

@end


my .plist includes

<key>NSAppTransportSecurity</key>

<dict>

<key>NSAllowsArbitraryLoads</key>

<true/>

<key>NSAllowsArbitraryLoadsForMedia</key>

<true/>

<key>NSAllowsArbitraryLoadsInWebContent</key>

<true/>

<key>NSExceptionDomains</key>

<dict>

<key>googleapis.com</key>

<dict>

<key>NSIncludesSubdomains</key>

<true/>

<key>NSExceptionMinimumTLSVersion</key>

<string>TLSv1.0</string>

<key>NSExceptionAllowsInsecureHTTPLoads</key>

<true/>

<key>NSExceptionRequiresForwardSecrecy</key>

<false/>

<key>NSThirdPartyExceptionMinimumTLSVersion</key>

<string>TLSv1.0</string>

<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>

<false/>

<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>

<true/>

</dict>

</dict>

</dict>



I receive the following errors

2016-10-27 14:11:37.651 com[2322:1744977] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9814)

2016-10-27 14:11:37.730 com[2322] <Error> [Firebase/Core][I-NET901017] <Firebase/Network/ERROR> Encounter network error. Code, error: -999, Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://play.googleapis.com/log, NSErrorFailingURLStringKey=https://play.googleapis.com/log, NSLocalizedDescription=cancelled}

2016-10-27 14:11:37.759 com[2322:1745037] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9814)

2016-10-27 14:11:37.783 com[2322] <Error> [Firebase/Analytics][I-ACS901017] Encounter network error. Code, error: -999, Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://app-measurement.com/config/app/1:871662309991:ios:7c633c48a9e59939?app_instance_id=13CD3CF5B68F44768F9AB618E4069B46&platform=ios&gmp_version=3700, NSErrorFailingURLStringKey=https://app-measurement.com/config/app/1:871662309991:ios:7c633c48a9e59939?app_instance_id=13CD3CF5B68F44768F9AB618E4069B46&platform=ios&gmp_version=3700, NSLocalizedDescription=cancelled}

2016-10-27 14:11:37.788 com[2322] <Error> [Firebase/Core][I-COR000020] Error posting to Clearcut: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://play.googleapis.com/log, NSErrorFailingURLStringKey=https://play.googleapis.com/log, NSLocalizedDescription=cancelled}



Plssssssssss Help Me


Thank You


Kristan Halls

Immacul8 Apps

Joshua Lagonera (Mobile Ads SDK Team)

unread,
Mar 6, 2017, 2:42:40 AM3/6/17
to Google Mobile Ads SDK Developers
Hi Kristan,

Is there a reason why you have included Firebase in your Unity Project, since the error you specified state that it is originating from the Firebase SDK?
If you are only using the Mobile Ads SDK for Unity, then I would suggest you use our official Unity Plugin instead of manually modifying the generated XCode project. 

Regards,
Joshua Lagonera
Mobile Ads SDK Team
Reply all
Reply to author
Forward
0 new messages