Introduction
VCS is the default rewarding option in the dashboard, so you should not have to make any configuration changes unless you have previously altered the setting.
If modifications to the rewarding settings are required, you can refer back to modifying your app settings.
Rewarding: VCS
Step 1: The Dashboard
VCS is configured by default.
Going to VCS
However, it can be turned On or Off by changing the Reward Handling mode in the Settings section at any time.
Adjusting Reward Handling
Now that VCS is configured, let's set up the SDK side.
Step 2: Conforming to the VCS Protocol
Handling VCS is based on asynchronous operations.
Make one of your classes conform to the FYBVirtualCurrencyClientDelegate
protocol and register it, via its delegate property:
#import "FyberSDK.h"
@interface GemStoreViewController : UIViewController
@end
class GemStoneDelegate: UIResponder, UIWindowSceneDelegate, FYBVirtualCurrencyClientDelegate {
// ...
}
Step 3: Request for New Rewards
To reward your users after they have engaged with a rewarded ad format, you request the delta of coins:
// Get the Virtual Currency Client
FYBVirtualCurrencyClient *virtualCurrencyClient = [FyberSDK virtualCurrencyClient];
virtualCurrencyClient.delegate = self; // self should conform to the FYBVirtualCurrencyClientDelegate protocol
// Request the delta of coins
[virtualCurrencyClient requestDeltaOfCoins];
// Get the Virtual Currency Client
let virtualCurrencyClient: FYBVirtualCurrencyClient = FyberSDK.virtualCurrencyClient()
virtualCurrencyClient.delegate = self // self should conform to the FYBVirtualCurrencyClientDelegate protocol
// Request the delta of coins
virtualCurrencyClient.requestDeltaOfCoins()
Best Practice Check
Some Offer Wall requests can take a few moments longer to load, so ensure that you've configured for a potential 5 second delay.
Although we recommend you call the VCS when returning from the Offer Wall (after a short delay; recommended 5 seconds), you can also call when you're loading the screen that shows currency or after the user comes back from the Offer Wall.
Handling Multiple Currencies
If you have created multiple currencies for your application on your dashboard, the previous usage returns the delta of coins to your default currency.
FYBVirtualCurrencyClient *virtualCurrencyClient = [FyberSDK virtualCurrencyClient];
virtualCurrencyClient.delegate = self;
// Specify the currency id parameter
FYBRequestParameters *parameters = [[FYBRequestParameters alloc] init];
parameters.currencyId = @"gems";
[virtualCurrencyClient requestDeltaOfCoinsWithParameters:parameters];
let virtualCurrencyClient: FYBVirtualCurrencyClient = FyberSDK.virtualCurrencyClient()
virtualCurrencyClient.delegate = self
// Specify the currency id parameter
let parameters: FYBRequestParameters = FYBRequestParameters.init(placementId: "Placement", currencyId: "gems")
virtualCurrencyClient.requestDeltaOfCoins(with: parameters)
Step 4: Handling the Response
You'll also need to implement the following method which will be called once the delta of coins has been requested:
- (void)virtualCurrencyClient:(FYBVirtualCurrencyClient *)client
didReceiveResponse:(FYBVirtualCurrencyResponse *)response
{
// Process the deltaOfCoins in the way that makes most sense for your application...
NSLog(@"Received delta of coins: %.2f %@ (currency id: %@)", response.deltaOfCoins, response.currencyName, response.currencyId);
}
func virtualCurrencyClient(_ client: FYBVirtualCurrencyClient!, didReceive response: FYBVirtualCurrencyResponse!) {
// Process the deltaOfCoins in the way that makes most sense for your application...
print(String(format: "Received delta of coins: %.2f %@ (currency id: %@)", response.deltaOfCoins, response.currencyName!, response.currencyId!))
}
You've set up Offer Wall via SDK!
Is your VCS throwing an error code? Review the VCS Error Types.
Optional: Disable the Toast Message
Fyber SDK displays a notification such as "Congratulations! You have earned 10 gold coins" whenever a reward is received. If you would like to disable the notification, add the following after starting the SDK:
[FyberSDK instance].shouldShowToastOnReward = NO;
FyberSDK.instance()?.shouldShowToastOnReward = false