iOS SDK v2 → v3
iOS SDK 3.0.0 reworks the SDK lifecycle into explicit steps — initialize(configuration:) → setPlayer(_:) → showOfferwall() → close() — and aligns the public API with the Android SDK. See the iOS SDK integration guide for the full walkthrough.
Side by side
| v2 | v3 | |
|---|---|---|
| App ID | AdGemAppID key in Info.plist | AdGem.initialize(configuration: AdGemConfiguration(appId: "ADGEM_APP_ID")) |
| Set the player | AdGem.setPlayerMetaData(metaData:) | AdGem.setPlayer(_:) |
| Metadata builder | AdGemPlayerMetadata.Builder.initWithPlayerId(playerId:) | AdGemPlayerMetadata.Builder(playerId:) |
| Builder setters | playerAge(age:), playerGender(gender:), playerPayer(spentMoney:), playerIAPTotal(iapTotal:), playerCreatedAt(creationDate:), … | age(_:), gender(_:), isPayer(_:), iapTotalUsd(_:), createdAt(_:), … |
| Load failures | untyped Error | NSError in AdGem.errorDomain with AdGemErrorCode (notInitialized, notReady, offerwallUnavailable, internalError) |
| Delegate methods | all required | optional |
| Offerwall presentation | root view controller | topmost view controller |
| IDFA | forwarded when available | forwarded only with ATTrackingManager authorization |
| Staging environment | supported | removed |
| Teardown | — | AdGem.close() |
Migrate
- Initialize in code. Remove the
AdGemAppIDkey fromInfo.plistand callAdGem.initialize(configuration: AdGemConfiguration(appId: "ADGEM_APP_ID"))early — typically inapplication(_:didFinishLaunchingWithOptions:). - Update the player setup. Replace
AdGemPlayerMetadata.Builder.initWithPlayerId(playerId:)withAdGemPlayerMetadata.Builder(playerId:), rename the setters (playerAge(age:)→age(_:),playerGender(gender:)→gender(_:),playerPayer(spentMoney:)→isPayer(_:),playerIAPTotal(iapTotal:)→iapTotalUsd(_:),playerCreatedAt(creationDate:)→createdAt(_:),customField1(field:)→customField1(_:), …), and replaceAdGem.setPlayerMetaData(metaData:)withAdGem.setPlayer(_:). - Check your player IDs. IDs longer than 256 characters are now rejected, and optional values are validated with the same bounds as the Android SDK.
- Handle typed errors. In
offerwallLoadingFailed(error:), the error is anNSErrorin theAdGem.errorDomain(com.adgem.sdk) domain — branch on itscode(AdGemErrorCode); forofferwallUnavailablethe underlying error is available viaNSUserInfo'sNSUnderlyingErrorKey. Delegate methods are now optional, so you can drop empty implementations. - Request ATT authorization if you want IDFA forwarded. Add an
NSUserTrackingUsageDescriptionentry toInfo.plistand callATTrackingManager.requestTrackingAuthorization— the SDK never prompts the user itself and omits the IDFA without authorization. - Remove staging-environment configuration. Staging support was removed; drop any staging endpoint overrides.
- Adopt
close()where useful. CallAdGem.close()on user logout or before re-initializing with a different App ID.