GSAdDelegate Protocol Reference
Conforms to | NSObject |
Declared in | GSAdDelegate.h |
Overview
The GSAdDelegate protocol defines the methods a delegate of a GSFullscreenAd object or a GSBannerAdView object should implement. The delegate receives notifications for ad fetch successes and failures, ad clickthroughs, and for when a fullscreen ad will take over the screen and dismiss from the screen.
The delegate is required to provide a UIViewController that ads should be displayed from, and can optionally provide a global unique identifier for the application and a value for the autoload property.
Tasks
-
– greystripeBannerDisplayViewController
The view controller that the banner ad’s browser should be displayed from.
-
– greystripeGUID
The global unique identifier for the application.
-
– greystripeBannerAutoload
A BOOL indicating whether the first banner ad should be fetched automatically.
-
– greystripeAdFetchSucceeded:
Sent when an ad has successfully been fetched and is ready to be displayed.
-
– greystripeAdFetchFailed:withError:
Sent if the ad fetch request failed.
-
– greystripeAdClickedThrough:
Sent when the ad is clicked through to the browser or to an external app.
-
– greystripeWillPresentModalViewController
Sent when a fullscreen ad is about to take over the screen, or when the browser is about to present modally for banner ads.
-
– greystripeWillDismissModalViewController
Sent when the fullscreen ad’s view controller or the browser view controller is about to animate off screen. If a view controller needs to be pushed or popped when the ad is dismissed, it should be done here.
-
– greystripeDidDismissModalViewController
Sent after the fullscreen ad’s view controller or the browser view controller has fully animated off screen. If the app wants to present a modal view controller after an ad has been dismissed, it must be done in this method. Modal presentation will not work from the greystripeWillDismissModalViewController method.
-
– greystripeBannerAdWillExpand
Sent when a banner ad’s view is about to expand to take over the full screen.
-
– greystripeBannerAdDidCollapse
Sent after an expanded banner ad has collapsed back to it’s normal size.
-
– greystripeShouldLogAdID
Return YES in this method in order to log out the ID for each ad. This defaults to NO.
Instance Methods
greystripeAdClickedThrough:
Sent when the ad is clicked through to the browser or to an external app.
- (void)greystripeAdClickedThrough:(id<GSAd>)a_ad
Parameters
- a_ad
The ad that clicked through.
Declared In
GSAdDelegate.h
greystripeAdFetchFailed:withError:
Sent if the ad fetch request failed.
- (void)greystripeAdFetchFailed:(id<GSAd>)a_ad withError:(GSAdError)a_error
Parameters
- a_ad
The ad that failed.
- a_error
The GSAdError that occured during fetching.
Discussion
The possible errors that may occur are:
kGSNoNetwork: This error is dispatched when there is no available network connection.
kGSNoAd: This error is dispatched when a blank ad is returned by the server.
kGSTimeout: This error is dispatched when the request took too long to complete.
kGSServerError: This error is dispatched when a server error occurs.
kGSInvalidApplicationIdentifier: This error is dispatched when the GUID provided by the application is not a valid Greystripe GUID.
kGSAdExpired: This error is dispatched when the ad that is fetched is expired and cannot be displayed.
kGSFetchLimitExceeded: This error is dispatched after the SDK prevents a fetch from occurring when it is highly unlikely that an ad would be returned. This error can occur in high volume, low fill situations or when too many ad requests are made in a short period of time. This error will resolve itself after a short timeout. If you frequently receive this message you should reduce the frequency of your requests or use an alternate fallback method when no ad is available.
kGSUnknown: This error is dispatched when the cause of the error is unknown.
Declared In
GSAdDelegate.h
greystripeAdFetchSucceeded:
Sent when an ad has successfully been fetched and is ready to be displayed.
- (void)greystripeAdFetchSucceeded:(id<GSAd>)a_ad
Parameters
- a_ad
The ad that succeeded.
Declared In
GSAdDelegate.h
greystripeBannerAdDidCollapse
Sent after an expanded banner ad has collapsed back to it’s normal size.
- (void)greystripeBannerAdDidCollapse
Declared In
GSAdDelegate.h
greystripeBannerAdWillExpand
Sent when a banner ad’s view is about to expand to take over the full screen.
- (void)greystripeBannerAdWillExpand
Declared In
GSAdDelegate.h
greystripeBannerAutoload
A BOOL indicating whether the first banner ad should be fetched automatically.
- (BOOL)greystripeBannerAutoload
Discussion
The default value is YES.
Warning: If this method is implemented, all subsequent setting of this property will be ignored.
Declared In
GSAdDelegate.h
greystripeBannerDisplayViewController
The view controller that the banner ad’s browser should be displayed from.
- (UIViewController *)greystripeBannerDisplayViewController
Discussion
Warning: This must be implemented for banner ads. This view controller cannot be popped or removed from the view heiarchy while the browser is being displayed.
Declared In
GSAdDelegate.h
greystripeDidDismissModalViewController
Sent after the fullscreen ad’s view controller or the browser view controller has fully animated off screen. If the app wants to present a modal view controller after an ad has been dismissed, it must be done in this method. Modal presentation will not work from the greystripeWillDismissModalViewController method.
- (void)greystripeDidDismissModalViewController
Declared In
GSAdDelegate.h
greystripeGUID
The global unique identifier for the application.
- (NSString *)greystripeGUID
Discussion
This must be set if it is not passed in on ad initialization.
Warning: This can only be set once by the application. All subsquent setting of the GUID will be ignored.
Declared In
GSAdDelegate.h
greystripeShouldLogAdID
Return YES in this method in order to log out the ID for each ad. This defaults to NO.
- (BOOL)greystripeShouldLogAdID
Declared In
GSAdDelegate.h
greystripeWillDismissModalViewController
Sent when the fullscreen ad’s view controller or the browser view controller is about to animate off screen. If a view controller needs to be pushed or popped when the ad is dismissed, it should be done here.
- (void)greystripeWillDismissModalViewController
Declared In
GSAdDelegate.h