Apple Mach O linker error objc_class_$_PFSignUpView - ios

I have been following the parse documentation to create a login and sign up for my app. It is giving me the error below:
Apple Mach O linker error objc_class_$_PFSignUpView
ld: warning: Auto-LinkAing supplied '/Users/Carson/Documents/CC/APP Dev/parse-library-1.8.0/ParseUI.framework/ParseUI', framework linker option at /Users/Carson/Documents/CC/APP Dev/parse-library-1.8.0/ParseUI.framework/ParseUI is not a dylib
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_PFLogInViewController", referenced from:
objc-class-ref in ViewController.o
"_OBJC_CLASS_$_PFSignUpViewController", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help would be greatfully received
Here is the code I have entered:
ViewController.h
//
// ViewController.h
// Parse3
//
// Created by Carson Carbery on 8/20/15.
// Copyright (c) 2015 Carson Carbery. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import <ParseUI/PFCollectionViewCell.h>
#import <ParseUI/PFImageView.h>
#import <ParseUI/PFLogInView.h>
#import <ParseUI/PFLogInViewController.h>
#import <ParseUI/PFProductTableViewController.h>
#import <ParseUI/PFPurchaseTableViewCell.h>
#import <ParseUI/PFQueryCollectionViewController.h>
#import <ParseUI/PFQueryTableViewController.h>
#import <ParseUI/PFSignUpView.h>
#import <ParseUI/PFSignUpViewController.h>
#import <ParseUI/PFTableViewCell.h>
#import <ParseUI/PFTextField.h>
#import <ParseUI/ParseUIConstants.h>
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
// Implement both delegates
#interface ViewController : UIViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>
#end
ViewController.m
// ViewController.m
// Parse3
//
// Created by Carson Carbery on 8/20/15.
// Copyright (c) 2015 Carson Carbery. All rights reserved.
//
#import "ViewController.h"
#interface ViewController ()
#end
#implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
[signUpViewController setDelegate:self]; // Set ourselves as the delegate
// Assign our sign up controller to be displayed from the login controller
[logInViewController setSignUpController:signUpViewController];
// Present the log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
// PF LOGIN METHODS
// Sent to the delegate to determine whether the log in request should be submitted to the server.
- (BOOL)loginViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
// Sent to the delegate when a PFUser is logged in.
- (void)logInViewController:(PFLogInViewController *)logInController didLogInUser:(PFUser *)user {
[self dismissViewControllerAnimated:YES completion:NULL];
}
// Sent to the delegate when the log in attempt fails.
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error {
NSLog(#"Failed to log in...");
}
// Sent to the delegate when the log in screen is dismissed.
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController {
[self.navigationController popViewControllerAnimated:YES];
}
// PF SIGNUP METHODS
// Sent to the delegate to determine whether the sign up request should be submitted to the server.
- (BOOL)signUpViewController:(PFSignUpViewController *)signUpController shouldBeginSignUp:(NSDictionary *)info {
BOOL informationComplete = YES;
// loop through all of the submitted data
for (id key in info) {
NSString *field = [info objectForKey:key];
if (!field || field.length == 0) { // check completion
informationComplete = NO;
break;
}
}
// Display an alert if a field wasn't completed
if (!informationComplete) {
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
}
return informationComplete;
}
//// Sent to the delegate when a PFUser is signed up.
//- (void)signUpViewController:(PFSignUpViewController *)signUpController didSignUpUser:(PFUser *)user {
// [self dismissModalViewControllerAnimated:YES]; // Dismiss the PFSignUpViewController
//}
// Sent to the delegate when the sign up attempt fails.
- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error {
NSLog(#"Failed to sign up...");
}
// Sent to the delegate when the sign up screen is dismissed.
- (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController {
NSLog(#"User dismissed the signUpViewController");
}

That's because PFLoginViewController and PFSignUpViewController are not part of the standard Parse distribution and SDK.
Instead, they are a drop-in class (named ParseUI-iOS) where the code is found here (a download link and a GitHub link, plus a tutorial of how to specifically make use of them).
You need to add those files into your project to be able to pick them up and compile them.

Related

GooglePlaces iOS, Can't load search results

GooglePlaces GMSAutocompleteViewController stopped searching for places.
GMSPlacesClient key is setup properly, It was working fine.
Please help if you know anything about this issue. Thanks.
your Google places Key will be expire or you are inserting wrong key. please check your Key
import <GoogleMaps/GoogleMaps.h>
#import "ViewController.h"
#interface ViewController ()<GMSAutocompleteViewControllerDelegate>
#end
#implementation ViewController
// TODO: Add a button to Main.storyboard to invoke onLaunchClicked:
// Present the autocomplete view controller when the button is pressed.
- (IBAction)onLaunchClicked:(id)sender {
GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
acController.delegate = self;
[self presentViewController:acController animated:YES completion:nil];
}
// Handle the user's selection.
- (void)viewController:(GMSAutocompleteViewController *)viewController
didAutocompleteWithPlace:(GMSPlace *)place {
// Do something with the selected place.
NSLog(#"Place name %#", place.name);
NSLog(#"Place address %#", place.formattedAddress);
NSLog(#"Place attributions %#", place.attributions.string);
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)viewController:(GMSAutocompleteViewController *)viewController
didFailAutocompleteWithError:(NSError *)error {
// TODO: handle the error.
NSLog(#"error: %ld", [error code]);
[self dismissViewControllerAnimated:YES completion:nil];
}
// User canceled the operation.
- (void)wasCancelled:(GMSAutocompleteViewController *)viewController {
NSLog(#"Autocomplete was cancelled.");
[self dismissViewControllerAnimated:YES completion:nil];
}
#end
visit
https://developers.google.com/places/ios-api/
I also face the same issue.
I make google API key on my credit card added account. but that key not working properly.
For resolve, this issue please updates your pods.

How to integrate Chartboost rewarded video with MoPub mediation for iOS

I make the game using Cocos2d-x ver. 3.4. I make the rewarded video with MoPub mediation in this game. I followed this guide on official github wiki.
So, first I incorporated the MoPub iOS SDK and Chartboost SDK in the project.
I set in AppDelegate.h:
#import <UIKit/UIKit.h>
#import "MoPub.h"
#import "MPRewardedVideo.h"
#interface AppDelegate : UIResponder <UIApplicationDelegate, MPRewardedVideoDelegate>
#property (strong, nonatomic) UIWindow *window;
#property (nonatomic, assign) NSInteger coinAmount;
#end
in AppDelegate.mm:
#implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
…
[self loadRewardedVideo];
return YES;
}
- (void)loadRewardedVideo {
[[MoPub sharedInstance] initializeRewardedVideoWithGlobalMediationSettings:nil delegate:self];
[MPRewardedVideo loadRewardedVideoAdWithAdUnitID:#“[MyAdUnitID]“ withMediationSettings:nil];
}
#pragma mark - MPRewardedVideoDelegate
- (void)rewardedVideoAdShouldRewardForAdUnitID:(NSString *)adUnitID reward:(MPRewardedVideoReward *)reward {
if ([reward.currencyType isEqualToString:#"coin"]) {
if ([reward.amount integerValue] == kMPRewardedVideoRewardCurrencyAmountUnspecified)
{
singleton->addToTotalCoins(10); // for test
} else
{
singleton->addToTotalCoins([reward.amount integerValue]);
}
}
}
This is buttons "showRewardedVideo" handler in RootViewController.mm:
#import "RootViewController.h"
#implementation RootViewController
- (void) showRewardedVideo
{
if ([MPRewardedVideo hasAdAvailableForAdUnitID:#"MyAdUnitID"])
{
[MPRewardedVideo presentRewardedVideoAdForAdUnitID:#"MyAdUnitID" fromViewController:self];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"Error"
message:#"Something went wrong"
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alertView show];
}
}
I set in MoPubSDK->AdNetworkSupport->Chartboost->ChartboostRewardedVideoCustomEvent.m:
- (void)requestRewardedVideoWithCustomEventInfo:(NSDictionary *)info
{
NSString *appId = [info objectForKey:#"MyChartboostAppID"];
NSString *appSignature = [info objectForKey:#"MyChartboostAppSignature"];
…
}
But when I run the application, I get in
- (void)communicatorDidReceiveAdConfiguration:(MPAdConfiguration *)configuration
the _networkType propertie = #"clear"
and get a message
MOPUB: Rewarded video ad is fetching ad network type: clear
The video is not displayed, and I get my alert window from RootViewController.mm -(void)showRewardedVideo method.
Seems MoPub doesn't know about Chartboost. I think, I need define settings in initializeRewardedVideoWithGlobalMediationSettings:nil, but how I should make this? I didn't found info about this.
Please tell me, what else needs to be done. Any help will be appreciated.
I think your problem is using no argument: initializeRewardedVideoWithGlobalMediationSettings:nil in loadRewardedVideo in AppDelegate.mm
In your guide they state that
Mediation settings enable you to pass in third-party network specific settings and can be provided as additional parameters during the rewarded video initialization call
so most probably you need that argument to be non-nil. Also, withMediationSettings should be non-null if you don't want MoPub to choose network by itself. They say it here:
The mediation settings array should contain ad network specific objects for networks that may be loaded for the given ad unit ID

Cannot get optional method of PFLoginViewControllerDelegate to implement properly when using Parse.com Framework

I have been trying to get this to work for the past 4 hours. I actually did get it to work about an hour ago, but then came back after a break, played with the code a little, and now it is not working again.
I am trying to implement an optional BOOL method that is declared in PFLoginViewControllerDelegate and it looks like this:
-(BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password;
In this Parse tutorial here, it says to paste the following code in to define this BOOL method:
// Sent to the delegate to determine whether the log in request should be submitted to the server.
-(BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
The problem is that I do not get the proper alert view window with a title of "Missing Information" and a body of "Make sure you fill out all of the information!".
I get an alert view window with the title of "Account Error" and a body of "Please double-check your information and try again".
Why is this BOOL method not working properly for me?
Below is the code inside of my View Controller's header file:
#import <Parse/Parse.h>
#interface ParseLoginViewController : PFLogInViewController <PFLogInViewControllerDelegate, PFSignUpViewControllerDelegate>
#end
Below is the code inside of my View Controller's main file:
#import "ParseLoginViewController.h"
#import <Parse/Parse.h>
#interface ParseLoginViewController ()
#end
#implementation ParseLoginViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
if (![PFUser currentUser]) { // No user logged in
// Create the log in view controller
PFLogInViewController *logInViewController = [[PFLogInViewController alloc] init];
[logInViewController setDelegate:self]; // Set ourselves as the delegate
// Create the sign up view controller
PFSignUpViewController *signUpViewController = [[PFSignUpViewController alloc] init];
[signUpViewController setDelegate:self]; // Set ourselves as the delegate
// Assign our sign up controller to be displayed from the login controller
[logInViewController setSignUpController:signUpViewController];
// Present the log in view controller
[self presentViewController:logInViewController animated:YES completion:NULL];
}
}
// Sent to the delegate to determine whether the log in request should be submitted to the server.
- (BOOL)logInViewController:(PFLogInViewController *)logInController shouldBeginLogInWithUsername:(NSString *)username password:(NSString *)password {
// Check if both fields are completed
if (username && password && username.length != 0 && password.length != 0) {
return YES; // Begin login process
}
[[[UIAlertView alloc] initWithTitle:#"Missing Information"
message:#"Make sure you fill out all of the information!"
delegate:nil
cancelButtonTitle:#"ok"
otherButtonTitles:nil] show];
return NO; // Interrupt login process
}
#end
Your UIAlertView is showing but getting dismissed quickly as another UIAlertView from SDK is kicking in.
From quick search that, as you know you won't be able to change ParseSDK. But you might be able to override the UIAlertView String via LocalisedString
NSString *ok = NSLocalizedString(#"OK", #"OK");
NSString *title = NSLocalizedString(#"Missing Information", #"Account Error");
NSString *message = NSLocalizedString(#"Make sure you fill out all of the information!", #"Please double-check your information and try again");
Ref: https://parse.com/questions/override-default-pfloginviewcontroller-login-error

AdMob Ios Error: Failed to receive ad with error: Request Error: No ad to show

i would add ADMOB to my xcode project, but when a test it on iphone and simulator i receive this error :
AdMob Ios Error: Failed to receive ad with error: Request Error: No ad to show.
my code Banner.h:
#import <UIKit/UIKit.h>
#import "GADBannerViewDelegate.h"
#class GADBannerView, GADRequest;
#interface BannerExampleViewController : UIViewController
<GADBannerViewDelegate> {
GADBannerView *adBanner_;
}
#property (nonatomic, retain) GADBannerView *adBanner;
- (GADRequest *)createRequest;
#end
Banner.m
#import "BannerExampleViewController.h"
#import "GADBannerView.h"
#import "GADRequest.h"
#import "SampleConstants.h"
#implementation BannerExampleViewController
#synthesize adBanner = adBanner_;
#pragma mark init/dealloc
// Implement viewDidLoad to do additional setup after loading the view,
// typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
// Initialize the banner at the bottom of the screen.
CGPoint origin = CGPointMake(0.0,
self.view.frame.size.height -
CGSizeFromGADAdSize(kGADAdSizeBanner).height);
// Use predefined GADAdSize constants to define the GADBannerView.
self.adBanner = [[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner
origin:origin]
autorelease];
// Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
// before compiling.
self.adBanner.adUnitID = kSampleAdUnitID;
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
self.adBanner.center =
CGPointMake(self.view.center.x, self.adBanner.center.y);
[self.adBanner loadRequest:[self createRequest]];
}
- (void)dealloc {
adBanner_.delegate = nil;
[adBanner_ release];
[super dealloc];
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
#pragma mark GADRequest generation
// Here we're creating a simple GADRequest and whitelisting the application
// for test ads. You should request test ads during development to avoid
// generating invalid impressions and clicks.
- (GADRequest *)createRequest {
GADRequest *request = [GADRequest request];
// Make the request for a test ad. Put in an identifier for the simulator as
// well as any devices you want to receive test ads.
request.testDevices =
[NSArray arrayWithObjects:#"6a47e320f03fe2ab9854afe2e5708321", nil];
return request;
}
#pragma mark GADBannerViewDelegate impl
// We've received an ad successfully.
- (void)adViewDidReceiveAd:(GADBannerView *)adView {
NSLog(#"Received ad successfully");
}
- (void)adView:(GADBannerView *)view
didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(#"Failed to receive ad with error: %#", [error localizedFailureReason]);
}
#end
One more thing to point out - if your banner space width/height is set ot 0, you'll receive exactly the same error. I'm currently trying to make a workaround about this because I want to animate ad view on screen only if it successfully load ad.
This is because the server have not update yet.
You should wait for 15 minutes and try again, it will work correctly.
PS: Remember replace kSampleAdUnitID with your App ID in Admob
This code work correctly when I am testing with my ID

Google AdMobs custom click events not working with unsupported network

I am using Google AdMobs DFP to serve up mediation banners from other networks. I have added Millennial and InMobi fine but now I need to add a network (YOC group) that does not have an adapter for DFP so I need to implement 'custom event banners'. I have read the guides and technical documents on implementing unsupported mediator networks with custom events but still cannot understand how it hooks up the two SDKs (Google AdMobs SDK and the mediator network's SDK).
The network that doesn't have an adapter (YOC) works if I hard-code the yoc ad id (of the format '9A9A9AA99999999A999AA9A99AA99AAAA999A9AA') to a sample ad and send off the request. The banner comes back fine and uses the YOC SDK to show an interactive/rich media advert.
However in my app I only have a Google DFP account id (of the format '/9999/company.app/channel') which I send off a request for using Google AdMobs SDK to DFP. The request then returns a response with the specific mediator ad network to try and request a banner advert from. My current setup is that YOC serves 100% of ads in DFP.
Problem: I get a banner advert returned from the YOC ad network and it displays on screen. It registers page impressions (with DFP) but there is no response to a touch/press event the way it works as if I hard-code the initialisation parameters of the yoc ad view. I can't however hard-code the yoc ad id (when initialising) because it would only work for one banner advert and I need different banners for each specific advert in each channel.
Below is the sample code I am trying to implement using just NSLogs in the methods to log to the console and show that the methods are being called. It is a very basic app and puts all the code in one place for ease of reading.
AppDelegate.h
#import < UIKit/UIKit.h>
#import "GADBannerView.h"
#import "GADBannerViewDelegate.h"
#import "GADCustomEventBanner.h"
#import "GADCustomEventBannerDelegate.h"
#import < YOCAdSDK/YOCAdView.h>
#interface AppDelegate : UIResponder <UIApplicationDelegate, GADBannerViewDelegate, GADCustomEventBanner, GADCustomEventBannerDelegate, YOCAdViewDelegate>
#property (strong, nonatomic) UIWindow *window;
#property (strong, nonatomic) UIViewController *root;
#end
AppDelegate.m
#import "AppDelegate.h"
#import "GADBannerView.h"
#import <YOCAdSDK/YOCAdSize.h>
#implementation AppDelegate
#synthesize root;
#synthesize delegate; // GADCustomEventBannerDelegate set on GADCustomEventBanner
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
CGRect bounds = [[UIScreen mainScreen] bounds];
self.window = [[UIWindow alloc] initWithFrame:bounds];
self.window.backgroundColor = [UIColor greenColor];
GADBannerView *banner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeLeaderboard origin:CGPointMake(0, 0)];
self.root = [[UIViewController alloc] initWithNibName:nil bundle:nil];
UIView *base = [[UIView alloc] initWithFrame:bounds];
base.backgroundColor = [UIColor greenColor];
self.root.view = base;
// the adUnitID is always of our DFP account number of the format '/9999/company.app/aa_aa<channelName>_<channelName>app'
banner.adUnitID = #"/9999/company.app/channel_specific_id";
banner.delegate = self;
banner.rootViewController = self.root;
self.delegate = self;
[base addSubview:banner];
[base bringSubviewToFront:banner];
[banner loadRequest:[GADRequest request]];
[self.window setRootViewController:self.root];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
[self.window makeKeyAndVisible];
return YES;
}
#pragma mark GADBannerViewDelegate
- (void)adViewDidReceiveAd:(GADBannerView *)view {
NSLog(#" adViewDidReceiveAd ");
NSLog(#" view: %# ", [view description]);
// for other ad networks here we get view.mediatedAdView = IMAdView (InMobi) or view.mediatedAdView = MMAdView (Millennial) but with YOC view.mediatedAdView = nil;
[self.delegate customEventBanner:self didReceiveAd:view];
}
- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error {
NSLog(#" didFailToReceiveAdWithError ");
[self.delegate customEventBanner:self didFailAd:error];
}
- (void)adViewWillPresentScreen:(GADBannerView *)adView {
NSLog(#" adViewWillPresentScreen ");
[self.delegate customEventBanner:self clickDidOccurInAd:adView];
[self.delegate customEventBannerWillPresentModal:self];
}
- (void)adViewWillDismissScreen:(GADBannerView *)adView {
NSLog(#" adViewWillDismissScreen ");
[self.delegate customEventBannerWillDismissModal:self];
}
- (void)adViewDidDismissScreen:(GADBannerView *)adView {
NSLog(#" adViewDidDismissScreen ");
[self.delegate customEventBannerDidDismissModal:self];
}
- (void)adViewWillLeaveApplication:(GADBannerView *)adView {
NSLog(#" adViewWillLeaveApplication ");
[self.delegate customEventBannerWillLeaveApplication:self];
}
#pragma mark GADCustomEventBanner
- (void)requestBannerAd:(GADAdSize)adSize
parameter:(NSString *)serverParameter
label:(NSString *)serverLabel
request:(GADCustomEventRequest *)request {
NSLog(#" requestBannerAd ");
// not sure if we initialiase the YOC tag here or how we would do this if can't hard code the yocTag to the format '9A9A9AA99999999A999AA9A99AA99AAAA999A9AA'
// and we only have the banner view returned from DFP with the id '/9999/company.app/channel_specific_id)'
YOCAdView *yocAdView = [[YOCAdView alloc] initWithYOCTag:serverParameter delegate:self size:kLeaderboard728x90 position:CGPointMake(0, 0)];
yocAdView.delegate = self;
[yocAdView load];
[self.root.view addSubview:yocAdView];
}
#pragma mark GADCustomEventBannerDelegate
- (void)customEventBanner:(id<GADCustomEventBanner>)customEvent didReceiveAd:(UIView *)view {
NSLog(#" [(GADBannerView *)view adUnitID]: %# ", [(GADBannerView *)view adUnitID]);
NSLog(#" [(GADBannerView *)view delegate]: %# ", [(GADBannerView *)view delegate]);
NSLog(#" [(id<YOCAdViewDelegate>)[customEvent delegate] viewControllerForPresentingYOCAdView]: %# ", [(id<YOCAdViewDelegate>)[customEvent delegate] viewControllerForPresentingYOCAdView]);
// not sure if we initialiase the YOC tag here or how we would do this if can't hard code the yocTag to '9A9A9AA99999999A999AA9A99AA99AAAA999A9AA"
// and we only have the banner view returned from DFP with the id '/9999/company.app/channel_specific_id'
[customEvent requestBannerAd:kGADAdSizeLeaderboard parameter:#"???" label:nil request:nil];
// the key might be that the [customEvent delegate] is of type YOCAdViewDelegate and we can do code specific to YOC here...
// but again not sure how to initialize the YOCAdView because we already have the banner view returned from DFP (with a different format account id)
// [(id<YOCAdViewDelegate>)[customEvent delegate] yocAdViewDidInitialize:yocAdView];
}
- (void)customEventBanner:(id<GADCustomEventBanner>)customEvent didFailAd:(NSError *)error {
NSLog(#" customEventBanner:didFailAd ");
}
- (void)customEventBanner:(id<GADCustomEventBanner>)customEvent clickDidOccurInAd:(UIView *)view {
NSLog(#" customEventBanner:clickDidOccurInAd ");
}
- (void)customEventBannerWillPresentModal:(id<GADCustomEventBanner>)customEvent {
NSLog(#" customEventBannerWillPresentModal ");
}
- (void)customEventBannerWillDismissModal:(id<GADCustomEventBanner>)customEvent {
NSLog(#" customEventBannerWillDismissModal ");
}
- (void)customEventBannerDidDismissModal:(id<GADCustomEventBanner>)customEvent {
NSLog(#" customEventBannerDidDismissModal ");
}
- (void)customEventBannerWillLeaveApplication:(id<GADCustomEventBanner>)customEvent {
NSLog(#" customEventBannerWillLeaveApplication ");
}
#pragma mark YOCAdViewDelegate
- (UIViewController *)viewControllerForPresentingYOCAdView {
NSLog(#" viewControllerForPresentingYOCAdView ");
return self.root;
}
- (void)yocAdViewDidInitialize:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewDidInitialize ");
}
- (void)yocAdView:(YOCAdView *)yocAdView didFailWithError:(NSError *)error {
NSLog(#" didFailWithError: %# ", error);
}
- (void)yocAdViewDidHide:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewDidHide ");
}
- (void)yocAdViewDidReload:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewDidReload ");
}
- (void)yocAdViewWillPresentModalViewController:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewWillPresentModalViewController ");
}
- (void)yocAdViewWillDismissModalViewController:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewWillDismissModalViewController ");
}
#end
Please can someone help give me things to try out and find out how to get the advert banner view returned from Google DFP responding to click events!?
There is a guide here on how to develop custom events.
If you're using AdMob SDK Mediation with ad unit /9999/company.app/channel, then this ad unit should be an SDK Mediation creative within DFP. One of your networks should be a Custom Event with the following settings:
Parameter: 9A9A9AA99999999A999AA9A99AA99AAAA999A9AA (or whatever your YOC tag is)
Label: YOC Group (This is just a label so you remember what this custom event is for)
Class Name: AppDelegate (You should really implement the custom event in it's own
class, and replace the class name with that class)
Then when implementing the custom event, you can reference serverParameter as the YOCTag like you already have.
You don't want to implement GADCustomEventBannerDelegate yourself. By your class implementing GADCustomEventBanner, and adding:
#synthesize delegate
at the top of your implementation, you have access to an instance of this object via:
self.delegate
You'll want to use that delegate to tell the custom event (and thereby AdMob Mediation) that YOC returned or failed to return an ad. Based on the YOC delegate, your mapping might look something like this:
- (UIViewController *)viewControllerForPresentingYOCAdView {
NSLog(#" viewControllerForPresentingYOCAdView ");
return self.root;
}
- (void)yocAdViewDidInitialize:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewDidInitialize ");
// Assuming this means the yocAdView was received.
[self.delegate customEventBanner:self didReceiveAd:yocAdView];
}
- (void)yocAdView:(YOCAdView *)yocAdView didFailWithError:(NSError *)error {
NSLog(#" didFailWithError: %# ", error);
[self.delegate customEventBanner:self didFailAd:error];
}
- (void)yocAdViewDidHide:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewDidHide ");
}
- (void)yocAdViewDidReload:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewDidReload ");
[self.delegate customEventBanner:self didReceiveAd:yocAdView];
}
- (void)yocAdViewWillPresentModalViewController:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewWillPresentModalViewController ");
[self.delegate customEventBanner:self clickDidOccurInAd:yocAdView];
[self.delegate customEventBannerWillPresentModal:self];
[self.delegate customEventBannerWillLeaveApplication:self];
}
- (void)yocAdViewWillDismissModalViewController:(YOCAdView *)yocAdView {
NSLog(#" yocAdViewWillDismissModalViewController ");
[self.delegate customEventBannerWillDismissModal:self];
}
Finally, you don't want to invoke GADCustomEventBannerDelegate methods in your GADBannerViewDelegate callback methods. These are invoked by AdMob telling you that mediation came back with an ad. The GADBannerViewDelegate implementation is part of your main app, and should stay out of your custom event class's implementation.
I know the guide invokes the custom event delegate methods in its GADBannerViewDelegate implementation. The difference is the guide is writing a custom event to implement AdMob, so in the context of the guide, the GADBannerViewDelegate is behaving like the YOCAdViewDelegate in your example.

Resources