Admob Interstitial exception - ios

I have 2 apps with Admob Interstitials.
Admob Interstitial stopped to work in 1 app.
I get exception calling loadRequest method.
Exception: -[__NSCFDictionary setObject:forKey:]: attempt to insert nil key
interestial = [[GADInterstitial alloc] init];
interestial.adUnitID = PUBID;
//interestial.delegate = interestialDelegate;
GADRequest *request = [GADRequest request];
[interestial loadRequest:request];
I made many many I spent day morfing code. Also I have same working code in another app.
May be it is something in project like missing framework or else
I tried Admob 6.3.0, 6.2.1, 6.1.5
Major change to my Admob code was upgrade to 6.3.0 but second app was also upgraded.
I am logging PUBID. It is not nil.
I do not pass NSDictionary to Admob my self.
The difference between apps is that it works in app with ARC and fails in non ARC app.

The most common problem is -ObjC flag in Other Linker Flags

Related

Integrating IMA iOS SDK

I have integrated google SDK manually without cocoapods because I'm using it inside a static library. And I have added all the frameworks (AVFoundation,..Etc) needed for IMA SDK.
My app getting crashed whenever I am trying to set IMASettings with the language.
Here is the error:
+[NSDictionary gtm_dictionaryWithHttpArgumentsString:]:
"unrecognized selector sent to"
This is my code :
- (IMASettings *)createIMASettings {
IMASettings *settings = [[IMASettings alloc] init];
settings.language = #"en";
return settings;
}
I have initialized the ads loader here :
self.adsLoader = [[IMAAdsLoader alloc] initWithSettings:[self createIMASettings]];
You miss a category with the method gtm_dictionaryWithHttpArgumentsString
now most likely, this IS part of the SDK but haven't setup the linker right
add -ObjC to your app's linker flags
if that isn't it, you're missing another framework from google - the google toolbox for mac

Why does not executing the following code cause it to crash?

I have an app that uses Admob. But since I am supporting versions of iOS 5 and above, I make sure that I don't call Admob code in versions below iOS 6 by doing the following:
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_5_1) {
int j = 2;
j++; //This is just some code so I can use breakpoints for testing.
NSLog(#"Google Mobile Ads SDK version: %#", [GADRequest sdkVersion]); //Commenting out the line prevents the crash
}
I am testing on iOS 5.1.1. Now if I comment out the NSLog, line, the app works without problem. But if I uncomment it the app crashes almost immediately within the main method:
int retVal = UIApplicationMain(argc, argv, nil, #"AppController");
I guess its not crashing when it is commented out because the compiler "optimises out" the code since its not used. But then what is the correct way to make sure the code isn't used, and the app doesn't crash ?
EDIT: I edited the code, the if block is not optimised out:
int j = 2;
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_5_1) {
j++; //This is just some code so I can use breakpoints for testing.
NSLog(#"Google Mobile Ads SDK version: %#", [GADRequest sdkVersion]); //Commenting out the line prevents the crash
}else{
j--;
}
NSLog(#"%d",j);
The output is "1", so the code in the else block executes. So even thought the function call [GADRequest sdkVersion] is not made, why does it crash ? Again, if I comment out the function call the app does not crash.
One possibility that is consistent with what you're describing is that linking to AdMob causes the crash. Sending a message to the GADRequest class in your code causes it to link to the GADRequest class, whereas if you didn't, it wouldn't link to it.
Why does linking to AdMob cause the crash? Most likely it's because AdMob links to several system frameworks, some of which may not exist on iOS 5 (e.g. AdSupport framework), so when it tries to dynamically link to them on app startup, the dynamic linker crashes.
I'm not sure what you can do. Maybe you can try explicitly linking to the system frameworks that AdMob use as "optional" in Xcode? (I haven't tested it.)
Otherwise, you could downgrade to a version of AdMob that supports iOS 5 (according to the release notes, any version before 7 should do).
I dont know why it crashes - but don't support iOS 5. It is pointless. The iOS market split is something like 20% iOS7, 80% iOS8. You cannot buy iOS5 phones, and you cannot install or, or even release apps for it.

Google Admob Integration Error in iOS

Google Admob Integration Error in iOS
I am using GoogleMobileAdsSdkiOS-6.12.2 latest version downloaded from https://developers.google.com/mobile-ads-sdk/download.
If I run on iOS 7.x, I am getting the following errors.
1) CFNetwork SSLHandshake failed (-108)
2) NSURLConnection/CFURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -108)
If I run on iOS 8.x, I am getting Crash due to "com.apple.nsurlconnectionloader exc_bad_access" error.
Added below code for integrate Google Admob.
GADBannerView *bannerView = [[GADBannerView alloc]initWithFrame:CGRectMake(0.0,self.view.frame.size.height -GAD_SIZE_320x50.height,GAD_SIZE_320x50.width,GAD_SIZE_320x50.height)];//Set Position
bannerView.adUnitID = #"ca-app-pub-3940256099942544/2934735716";
bannerView.rootViewController = self;
GADRequest *request = [GADRequest request];
request.testDevices = #[ GAD_SIMULATOR_ID, #"MY_TEST_DEVICE_ID" ];
[bannerView loadRequest:request];
Anyone please help me to get out of this issue.
In my case, It is because of the Network blocker issue.
If I run this code in my office, I am getting these type of errors.
If I run same on my home, It is working fine.
Because in my office they are blocking adds.
So I asked my N/W admin to allow adds on my system, He allowed, My issue resolved.
It is a network not getting error.Please check any blocking or Proxy.

Failed to open Apple Pay sheet on iPhone 6

I want to make an example project that open an Apple Pay sheet when user clicks on the 'Pay with Apple Pay' button on my app.
I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay) and Xcode 6.1 GM. Both of them have not been officially released yet.
I followed the tutorial on this page. And this is my code for handling the on-click event of 'Pay with Apple Pay' button:
PKPaymentRequest *request = [PKPaymentRequest new];
// Must be configured in Apple Developer Member Center
// Doesn't seem like the functionality is there yet
request.merchantIdentifier = #"my.valid.merchant.identifier";
request.countryCode = #"US";
request.currencyCode = #"USD";
// Let's go!
// if (![PKPaymentAuthorizationViewController canMakePayments]) return;
PKPaymentAuthorizationViewController *authVC = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
authVC.delegate = self;
[self presentViewController:authVC animated:YES completion:nil];
Clicking on the 'Pay with Apple Pay' button, I got this error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target
When checking the PKPaymentAuthorizationViewController canMakePayments], it returns false.
I'm not sure about the reason of my error is of the iPhone's setting or my code.
Does someone have the experience with Apple Pay? Please help me. Thank you so much.
I test my app on an iPhone 6 with iOs version 8.1 (which contains Apple Pay)
No, the most recent beta (iOS 8.1 Beta 2) does not contain Apple Pay. There's obviously some stuff in there under the hood as they're working on it, but it's not intended to work for developers yet.
This is why [PKPaymentAuthorizationViewController canMakePayments] returns NO and authVC is nil. Apple Pay is also not available in Settings, nor is it mentioned in the release notes.

AppLovin SDK reports internal error. Code = -1. IOS

I'm doing everything as in the instructions.
But when I do
[ALInterstitialAd shared].adDisplayDelegate = self;
[ALInterstitialAd shared].adLoadDelegate = self;
[ALInterstitialAd showOver:[[UIApplication sharedApplication] keyWindow]];
I receive code = -1 in
-(void)adService:(ALAdService *)adService didFailToLoadAdWithError:(int)code
AppLovin SDK reports internal error.
In applovin site all ads is ON, and bundle id the same.
What could it be? Thanks
I connect with AppLovin manager and they told me that because my country is not supported
I released my game with "AppLovin SDK reports internal error" and now it's work correctly. I asked Applovin support and they told me it may be because there is no Ad for user to show at this time.

Resources