# Rewarded Ads

Rewarded Ads are loaded automatically. You can observe ad loading events by specifying the delegate:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
BIDRewarded *rewarded = [BIDRewarded new];
rewarded.loadDelegate = loadDelegate;
```

{% endtab %}

{% tab title="Swift" %}

```swift
let rewarded = BIDRewarded()
rewarded.loadDelegate = loadDelegate
```

{% endtab %}
{% endtabs %}

The delegate should implement the following methods:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#pragma mark - BIDFullscreenLoadDelegate protocol methods

- (void)didLoadAd:(BIDAdInfo*)adInfo
{
    NSLog(@"Rewarded - didLoadAd. AdInfo: %@", adView, adInfo);
}

- (void)didFailToLoadAd:(BIDAdInfo*)adInfo error:(NSError *)error
{
    NSLog(@"Rewarded - didFailToLoadAd. AdInfo: %@. Error: %@", adInfo, error);
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
//BIDFullscreenLoadDelegate protocol methods
    
func didLoadAd(_ adInfo: BIDAdInfo) {
    print("Rewarded - didLoadAd. AdInfo: \(adInfo)")
}
    
func didFail(toLoadAd adInfo: BIDAdInfo, error: Error) {
    print("Rewarded - didFailToLoadAd. AdInfo: \(adInfo). Error: \(error)")
}
```

{% endtab %}
{% endtabs %}

## Showing a Rewarded Ad

To show a rewarded ad, call `showWithDelegate` instance method of the `BIDRewarded` class:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[rewarded showWithDelegate:theDelegate];
```

{% endtab %}

{% tab title="Swift" %}

```swift
rewarded.show(with: theDelegate)
```

{% endtab %}
{% endtabs %}

The delegate should implement the following methods:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
#pragma mark - BIDInterstitialDelegate protocol mehods

//TODO: simplify this method. It should simply return the appropriate View Controller to display ad
- (UIViewController*)viewControllerForDisplayAd
{
    return viewController;
}

- (void)didDisplayAd:(BIDAdInfo*)adInfo
{
    NSLog(@"Rewarded - didDisplayAd. AdInfo: %@", adView, adInfo);
}

- (void)didClickAd:(BIDAdInfo*)adInfo
{
    NSLog(@"Rewarded - didClickAd. AdInfo: %@", adView, adInfo);
}

- (void)didHideAd:(BIDAdInfo*)adInfo
{
    NSLog(@"Rewarded - didHideAd. AdInfo: %@", adView, adInfo);
}

- (void)didFailToDisplayAd:(BIDAdInfo*)adInfo error:(NSError *)error
{
    NSLog(@"Rewarded - didFailToDisplayAd. AdInfo: %@ Error: %@", adInfo, error);
}

-(void)allNetworksDidFailToDisplayAd
{
    NSLog(@"Rewarded - allNetworksDidFailToDisplayAd");
}

- (void)didRewardUser
{
    NSLog(@"Reward - didRewardUser");
}
```

{% endtab %}

{% tab title="Swift" %}

```swift
//BIDInterstitialDelegate protocol mehods
    
//TODO: simplify this method. It should simply return the appropriate View Controller to display ad
func viewControllerForDisplayAd() -> UIViewController {
    return viewController;
}
    
func didDisplayAd(_ adInfo: BIDAdInfo) {
    print("Rewarded - didDisplayAd. AdInfo: \(adInfo)")
}
    
func didClickAd(_ adInfo: BIDAdInfo) {
    print("Rewarded - didClickAd. AdInfo: \(adInfo)")
}
    
func didHideAd(_ adInfo: BIDAdInfo) {
    print("Rewarded - didHideAd. AdInfo: \(adInfo)")
}
    
func didFail(toDisplayAd adInfo: BIDAdInfo, error: Error) {
    print("Rewarded - didFail toDisplayAd. AdInfo: \(adInfo). Error: \(error)")
}
    
func allNetworksDidFailToDisplayAd() {
    print("Rewarded - allNetworksDidFailToDisplayAd.")
}

func didRewardUser() {
    print("Rewarded - didRewardUser")
}
```

{% endtab %}
{% endtabs %}

## Stopping and Starting Auto-Load

By default, Rewarded preload ads before any manual load attempt. So a Rewarded can use already preloaded ads instead of waiting on a manual load call to load new ads. To disable this feature you need to call the following method:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
rewarded.autoload = NO;
```

{% endtab %}

{% tab title="Swift" %}

```swift
rewarded.autoload = false
```

{% endtab %}
{% endtabs %}

Once you disable autoload, you should load ads manually every time you need them to show:

{% tabs %}
{% tab title="Objective-C" %}

```objectivec
[rewarded load];
```

{% endtab %}

{% tab title="Swift" %}

```swift
rewarded.load()
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bidapp.io/integration/ios/rewarded-ads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
