MAX - iOS

Based on the MAX demo project: https://github.com/AppLovin/AppLovin-MAX-SDK-iOS you can check the Nefta custom adapter integration example here: https://github.com/Nefta-io/NeftaMAXAdapter

Include the SDK

You can download the latest Nefta adapter from https://github.com/Nefta-io/NeftaMAXAdapter/releases.

Extract the content of the zip file to your project.

Given that your project name is AppLovin MAX Demo App - Swift it could look like this:

In your project settings add NeftaSDK.xcframework to Frameworks, Libraries, and Embedded Content for the project target:

In the opened popup click on Add Other... and select NeftaSDK.xcframework in the extracted location from the previous step. After this, the NeftaSDK should be included like this:

The last step is to include the adapter source code. We can do this by right-clicking on the project and selecting Add Files to "YourProject"...:

Select NeftaAMAdapter from the extracted folder and make sure to add this folder with Create groups and not Create folder references and that the files will be added as targets to your project:

Code integration

The plugin has to be manually initialized, preferably as soon as possible to have good game events:

import NeftaSDK

let plugin = NeftaPlugin_iOS.Init(appId: "5661184053215232")
#import "NeftaAdapter.h"

NeftaPlugin_iOS *plugin = [NeftaPlugin_iOS InitWithAppId: @"5661184053215232"];

In the dashboard you can access the AppId which you need to enter in the code above.

Events

Game events can be then recorded as follows:

plugin.Events.AddSpendEvent(category: NeftaEvents.ResourceCategory.PremiumCurrency,
                           method: NeftaEvents.SpendMethod.Upgrade)

plugin.Events.AddProgressionEvent(status: NeftaEvents.ProgressionStatus.Start,
                                         type: NeftaEvents.ProgressionType.GameplayUnit,
                                         source: NeftaEvents.ProgressionSource.CoreContent,
                                         name: "area-4",
                                         value: 21)
[plugin.Events AddSpendEventWithCategory: ResourceCategoryPremiumCurrency
                                       method: SpendMethodUpgrade];

[plugin.Events AddProgressionEventWithStatus: ProgressionStatusStart
                                             type: ProgressionTypeGameplayUnit
                                           source: ProgressionSourceCoreContent
                                             name: "area-4"
                                            value: 21];

Testing

To put the adapter in test mode and enable logs:

NeftaPlugin_iOS.EnableLogging(enable: true)
[NeftaPlugin_iOS EnableLogging: true];

With this, you will see the following lines in the debug console:

2024-04-04 07:12:53.317 1 [NeftaPlugin] Core initialized 9ea84634-02b6-40ba-92d1-4498997bab66 n:20 s:6
2024-04-04 07:12:53.402 1 [NeftaPlugin] OnResume 1711444731265 1712207573402 762842137

With this, we know that the SDK is integrated correctly.

To receive test ads you have to add your user to Test users in https://platform.nefta.io/dashboard/company Test Users:

You get the NUID in Core initialized debug output from before, or with the following code:

let nuid = plugin.ShowNuid()
NSString *nuid = [plugin ShowNuid];

With this, you will start receiving Nefta ads.

All done

With this technical part, make sure you have Nefta mediation enabled in your AdMob configuration: https://docs.nefta.io/docs/max-configuration.