Skip to main content

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

v2v3
App IDAdGemAppID key in Info.plistAdGem.initialize(configuration: AdGemConfiguration(appId: "ADGEM_APP_ID"))
Set the playerAdGem.setPlayerMetaData(metaData:)AdGem.setPlayer(_:)
Metadata builderAdGemPlayerMetadata.Builder.initWithPlayerId(playerId:)AdGemPlayerMetadata.Builder(playerId:)
Builder settersplayerAge(age:), playerGender(gender:), playerPayer(spentMoney:), playerIAPTotal(iapTotal:), playerCreatedAt(creationDate:), …age(_:), gender(_:), isPayer(_:), iapTotalUsd(_:), createdAt(_:), …
Load failuresuntyped ErrorNSError in AdGem.errorDomain with AdGemErrorCode (notInitialized, notReady, offerwallUnavailable, internalError)
Delegate methodsall requiredoptional
Offerwall presentationroot view controllertopmost view controller
IDFAforwarded when availableforwarded only with ATTrackingManager authorization
Staging environmentsupportedremoved
TeardownAdGem.close()

Migrate

  1. Initialize in code. Remove the AdGemAppID key from Info.plist and call AdGem.initialize(configuration: AdGemConfiguration(appId: "ADGEM_APP_ID")) early — typically in application(_:didFinishLaunchingWithOptions:).
  2. Update the player setup. Replace AdGemPlayerMetadata.Builder.initWithPlayerId(playerId:) with AdGemPlayerMetadata.Builder(playerId:), rename the setters (playerAge(age:)age(_:), playerGender(gender:)gender(_:), playerPayer(spentMoney:)isPayer(_:), playerIAPTotal(iapTotal:)iapTotalUsd(_:), playerCreatedAt(creationDate:)createdAt(_:), customField1(field:)customField1(_:), …), and replace AdGem.setPlayerMetaData(metaData:) with AdGem.setPlayer(_:).
  3. 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.
  4. Handle typed errors. In offerwallLoadingFailed(error:), the error is an NSError in the AdGem.errorDomain (com.adgem.sdk) domain — branch on its code (AdGemErrorCode); for offerwallUnavailable the underlying error is available via NSUserInfo's NSUnderlyingErrorKey. Delegate methods are now optional, so you can drop empty implementations.
  5. Request ATT authorization if you want IDFA forwarded. Add an NSUserTrackingUsageDescription entry to Info.plist and call ATTrackingManager.requestTrackingAuthorization — the SDK never prompts the user itself and omits the IDFA without authorization.
  6. Remove staging-environment configuration. Staging support was removed; drop any staging endpoint overrides.
  7. Adopt close() where useful. Call AdGem.close() on user logout or before re-initializing with a different App ID.