Admob RewardedVideo via Firebase - ios

i know this kind of question has been asked a lot but i've tried everything out there and cannot find what is going on.
I'm not using mediation and I have no troubles showing Interstitial. Here is my configuration:
class MainContainerViewController: UIViewController, GADInterstitialDelegate, GADRewardBasedVideoAdDelegate {
var rewardBasedVideo: GADRewardBasedVideoAd?
override func viewDidLoad() {
super.viewDidLoad()
...
rewardBasedVideo = GADRewardBasedVideoAd.sharedInstance()
rewardBasedVideo?.delegate = self
let request = GADRequest()
request.testDevices = ["b8d6d8f423b67dc1855d953466503d0d"]
rewardBasedVideo?.load(request, withAdUnitID: "ca-app-pub-3872067921404234/2000937302")
}
func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd, didFailToLoadWithError error: Error) {
NSLog("didFailToLoad \(error.localizedDescription)")
}
}
I've tried loading AdUnitID for testing with no success and the log everytime i tried to load a new rewarded video is showing:
<Google> Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.
didFailToLoad No ad returned from any ad server.
Any help would be great. Thanks in advance,
//EDIT
Could it be related with device size? I've tested on simulator and it works fine but on iPhone 7plus the result is the one showed above. Anyone can confirm this???

Make sure to install the Adapter SDK, Firebase SDK correctly and link them correctly in the BuildPhases -> Link Binary with Libraries. Also add the search paths as mentioned in the docs. The error means that either there is no ad to display or you're receiving a faulty Ad. I checked your Ad Unit ID with sample apps and everything works fine. Check your implementation and Pod installation again.

Related

Why am I getting a AXServer error when sharing data via Snapchat SDK?

I am using the example xcode project for sharing media between my app and Snapchat directly. I have successfully authenticated my app by this point (it loads bitmoji + user info and I can print the access token). The code that causes the error is invoked after the UIPicker has selected an image:
from line 38 of MediaPickerViewController.swift
fileprivate func shareImage(image: UIImage) {
let snapPhoto = SCSDKSnapPhoto(image: image)
let snapContent = SCSDKPhotoSnapContent(snapPhoto: snapPhoto)
// Send it over to Snapchat. This produced the error below
snapAPI.startSending(snapContent)
}
Then when you pick an image from the gallery:
2020-03-23 17:49:54.487603-0700 CreativeKitSample[20966:5903027]
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:
Permission denied portName:'com.apple.iphone.axserver' PID:20969
This is running on my iPhone, debugging over USB. I'm new to Swift development, and my best guess is that my app is developer certificate signed, perhaps it is sandboxed on iOS 13 from communication with prod apps? Or is the AXServer more of a Core UI thing or Accessibility? This project uses Interface Builder/Storyboards. I tried disabling accessibility checkbox on UI elements. I'm at a loss here, searching for AXServer permission errors has not been useful.
some AX errors:
https://github.com/TimOliver/TOCropViewController/issues/402
https://forums.developer.apple.com/thread/120696 (clue that it may be inter-app permission)
https://bugs.webkit.org/show_bug.cgi?id=203618 (sandbox extension?)
I'm an idiot. When I created my Apple Developer Cert and Provisioning Profile, I had a collision with the package identifier, so I changed it in the provisioning settings but neglected to update the snapchat portal's bundle ID. Leaving the question here for anyone else with the same problem.
They could make their error a bit more descriptive...
I got maybe a solution... I'm dismissing before the current View Controller, then present the SFSafariViewController.
Using following Code does help me out! (Xcode 11.3.1, macOS 10.14.6, iOS 13.3)
DispatchQueue.main.async(execute: {
// code goes here
})
// my solution...
DispatchQueue.main.async {
self.present(safariVC, animated: true, completion: nil)
}

ARSession crashes with Testflight, not with Xcode

I have made an app that tracks 2D body motion data using the back camera. I have followed Apple's example to create an ARView from the storyboard, and have added this code in my viewDidAppear:
arView.session.delegate = self
// If the iOS device doesn't support body tracking, raise a developer error for
// this unhandled case.
guard ARBodyTrackingConfiguration.isSupported else {
fatalError("This feature is only supported on devices with an A12 chip")
}
// Run a body tracking configration.
let configuration = ARBodyTrackingConfiguration()
arView.session.run(configuration)
When I open the app everything works perfectly when installing from Xcode, but the app crashes when installing from TestFligth. Crash log shows me the last backtrace log at arView.session.delegate = self
I've found a workaround in case someone faces the same problem. According to Apple this is a known issue in XCode 11. To solve it, you need to manually add RealityKit to your target’s Link Binary with Libraries build phase. Hope this helps

FaceBook Native ads is not loading in iOS?

I am trying to implement Facebook native ads on my device. Test ads are working fine. However, production ads are not showing. It does displays an error showing
DiskCookieStorage changing policy from 2 to 0,cookie file: file:///private/var/mobile/Containers/Data/Application/9B89E486-EDF8-4E20-A7CE-CB60747C3E8B/Library/Cookies/Cookies.binarycookies
and
DiskCookieStorage changing policy from 0 to 2, cookie file: file:///private/var/mobile/Containers/Data/Application/9B89E486-EDF8-4E20-A7CE-CB60747C3E8B/Library/Cookies/Cookies.binarycookies
What I did is loading the ads in viewdidLoad
func setupFacebookNativeAds()
{
let nativeAd = FBNativeAd(placementID: Constants.adMob.FB_NATIVE_ID)
nativeAd.delegate = self
nativeAd.loadAd()
}
What will be the issue here?
I found a solution by adding new test devices in the Monetisation Manager. Get the IDFA for the ios devices and add new test devices. Now the Native Ads view is working.

Firebase/Admob installation guide with pods on Cocoapods site vs Firebase installation guide on google

I'm trying to integrate firebase/admob ads for ios app using Cocoapods.
On Cocaopods site there is a guide such as downloading Cocoapods first then creating a pod file in the app and adding a code using pods. On Google site there are also instructions on how to install firebase ads sdk using pods but then it seems that I also need to insert coding such as gad etc in the actual application. I'm new to this, so I'm a bit confused - is Cocoapods coding enough or do I also need to add coding in the application as well in terms of initializing ads or creating buttons for specific ads such as banner/interstitial etc?
You have to add some coding in the app as well such that importing the Googlemobileads in the app delegate and configuring it in the func didFinishLaunchingWithOptions:
GADMobileAds.configure(withApplicationID: "Your application id")
and then adding the below code in your first controller or the controller in which you want to show the adds:
var bannerView: GADBannerView!
bannerView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
bannerView.frame.origin.y = self.view.frame.size.height - bannerView.frame.size.height
self.view.addSubview(bannerView)
bannerView.adUnitID = "Your ad unit id"
bannerView.rootViewController = self
bannerView.load(GADRequest())
Also, I think the code is in C that's why I had problems with it and not Swift. I've managed to get almost everything done - I have a problem when I use self.bannerView and also GADBannerView with messages that it hasn't been declared previously. I tried to follow Objective C because that's how the code looks like, but don't seem to be able to resolve this.

Admob and Interstitial Ads with iOS9

Today I registered to adMob and I started working on adMob ads inside my apps.The first one is a game (with viewcontrollers) and i want to show an interstitial ad right after the game over screen, so i want to load the interstitial right after the view with game over loads (this view is accessible only after game over and a game lasts for one minute so it should not appear too often)
I have seen many tutorials, on youtube and on admob website, i had many problems like:
admob framework not found even if I imported it,
i disabled bitcode to avoid linker errors when i build,
but i still can't see the test ad on my app, on the simulator and real devices.
I imported all the frameworks required by admob, and in xcode i have a question mark near GoogleMobileAds framework, what does it mean?
First line about admob is:
import GoogleMobileAds
inside viewcontroller
var interstitial: GADInterstitial!
func createNloadAd () -> GADInterstitial
{
var ad = GADInterstitial(adUnitID: "XXX")
var request = GADRequest()
request.testDevices = [kGADSimulatorID]
ad!.loadRequest(request)
return ad
}
inside viewdidload
self.interstitial = self.createNloadAd()
if(self.interstitial!.isReady)
{
self.interstitial!.presentFromRootViewController(self)
self.interstitial! = self.createNloadAd()
}
in adUnitID I tried the ID of the interstitial i created in admob website, and other strings found inside tutorials, but none worked
in testdevices i added my iphone's UDID after i see the message in output, but i can't see any test ad and i have no error at all
And i didn't touch the storyboard,do I have to create something in the storyboard?
Before submitting the app to appstore i have to remove the testdevices line?And of course put my real AdUnitID
Maybe the code is right but if the app is not published admob won't load, or maybe I have to wait a day before my admob id starts working
Where I can find recent admob IDs for testing?
So i test the app, and if works i change the id and submit
I am using Xcode 7.1, AdMob 7.5.2, and my app deployment target is iOS7 and i tested it on simulator with 9.1 and my old iPhone4 with iOS7, and this should not be a problem because admob supports even iOS6
Another question about admob guidelines, in other apps can i use iAd in a view and Admob in an other?May i be banned for this?only banner ads in lower part of the screen
AdMob framework not found even if I imported it
Remove the framework and import it again. Make sure you're checking "Copy items if needed". Also, check your library search paths under your project settings and build phases to see if the framework is include.
I imported all the frameworks required by AdMob
This is not necessary. The AdMob framework will import the frameworks it needs once you include import GoogleMobileAds.
And I didn't touch the storyboard. Do I have to create something in the storyboard?
No
Before submitting the app to App Store I have to remove the test devices line and put my real AdUnitID?
Yes. Try using your real AdUnitID now to see if your test ID is causing the problem.
Maybe the code is right but if the app is not published AdMob won't load, or maybe I have to wait a day before my AdMob id starts working
No. The application does not have to be published to receive live advertisements.
Where I can find recent AdMob IDs for testing? So I test the app, and if works I change the id and submit
Nowhere. It is not wise to give out your AdUnitID.
Another question about AdMob guidelines, in other apps can I use iAd in a view and AdMob in an other? May I be banned for this? Only banner ads in lower part of the screen
Use as many ad networks in your application as you'd like. There's nothing stating you aren't allowed to.
Sounds like you're on the right track. You should set and include the interstitial's delegate methods though to see if you're getting any error messages. You need to allow arbitrary loads in your .plist too. Check AdMob's iOS 9 Considerations.
Are you calling createNloadAd() before you attempt to present the interstitial in your viewDidLoad? It takes time to download the advertisement.
Make sure the AdUnitID provided by AdMob is identical to the one you're using.
Also, move the presentation from viewDidLoad to viewDidAppear.
Here's an example of creating our interstitial in our AppDelegate.swift and then presenting the interstitial in our ViewController.swift:
AppDelegate.swift
import UIKit
import GoogleMobileAds // Import AdMob
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, GADInterstitialDelegate { // Include delegate
var window: UIWindow?
var myInterstitial : GADInterstitial?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// App launched
// Load interstitial
myInterstitial = createAndLoadInterstitial()
return true
}
func createAndLoadInterstitial()->GADInterstitial {
let interstitial = GADInterstitial(adUnitID: "Your Ad Unit ID")
interstitial.delegate = self
interstitial?.loadRequest(GADRequest())
return interstitial
}
func interstitialDidReceiveAd(ad: GADInterstitial!) {
print("interstitialDidReceiveAd")
}
func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) {
print(error.localizedDescription)
}
func interstitialDidDismissScreen(ad: GADInterstitial!) {
print("interstitialDidDismissScreen")
myInterstitial = createAndLoadInterstitial()
}
ViewController.swift (This would be your game over view controller)
import UIKit
class ViewController: UIViewController {
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate // Create reference to our app delegate
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(animated: Bool) {
appDelegate.myInterstitial?.presentFromRootViewController(self)
}

Resources