iOS Integration

Initialization

1. Import the InMobi SDK header and initialize it:

IMSdk.initWithAccountID("accountID", consentDictionary: [IM_GDPR_CONSENT_AVAILABLE: 
"true", IM_GDPR_CONSENT_IAB: "<<consent in IAB format>>" ]) { (error) in
            if let error = error {
                print(error.localizedDescription)
            } 
}

2. Create a user data model as follows:

let phoneNumber = IMUserDataTypes(md5: "2wse3e", sha256: "6tghjk")
let emailId = IMUserDataTypes(md5: "ujhjk99", sha256: "jhjyure4")
let userDataModel = IMUserDataModel(phoneNumber: phoneNumber, emailId: emailId, extra: nil)

 3. Pass this data model to fetch the API:

IMUnifiedIdService.push(data: userDataModel) 

4. Call this API to fetch the UnifIDs.

IMUnifiedIdService.fetchUnifiedIds(delegate: self)

Callbacks

Implement the following delegates to receive the callbacks.

class ViewController: IMUnifiedIdInterface {
    onFetchCompleted(response: Dictionary?, error: Error?) {
    }
}

Reset

Call this reset API to clear all the user-related data and IDs stored in the SDK:

IMUnifiedIdService.reset()

Publisher provided Unified Ids (Optional)

If you have an ID from a Vendor, you can use it in the following SDK. If there is an overlap, the system prioritizes the InMobi procured Unified IDs.

IMSdk.setPublisherProvidedUnifiedID(unifiedIds : Dictionary?);

JSONObject structure:

{
    "id5" : "json(blob)",
    "liveramp": "json(blob)"
}

On This Page

Last Updated on: 18 Jan, 2024