iOS SDK for collecting and reporting device data to MaxMind.
- iOS 15.0+
- Swift 5.9+
- Xcode 15.0+
Add the package dependency to your Package.swift:
dependencies: [
.package(url: "https://github.com/maxmind/device-ios.git", from: "0.1.0")
]Or in Xcode: File > Add Package Dependencies and enter the repository URL.
import MinFraudDevice
let config = SDKConfig(accountID: 123456)
let tracker = DeviceTracker(config: config)Use the tracking token in your calls to the minFraud API.
do {
// Collect the device data and send to the minFraud Device API.
let result = try await tracker.collectAndSend()
// Provide the received tracking token to your backend to use with the
// minFraud API.
sendToBackend(trackingToken: result.trackingToken)
} catch {
print("Failed to send device data: \(error)")
}let config = SDKConfig(
accountID: 123456, // Your MaxMind account ID
serverURL: nil, // nil = default dual-stack servers
loggingEnabled: false, // enable logging via os.Logger
collectionIntervalSeconds: 0 // 0 = disabled; 300–86400 = automatic collection interval in seconds
)| Parameter | Type | Default | Description |
|---|---|---|---|
accountID |
Int | required | Your MaxMind account ID |
serverURL |
URL? | nil |
Custom server URL (nil = default dual-stack servers) |
loggingEnabled |
Bool | false |
Enable logging via os.Logger |
collectionIntervalSeconds |
Int | 0 |
Auto-collection interval in seconds (0 = disabled, 300–86400) |
When collectionIntervalSeconds is set to a value between 300 and 86400, the
tracker automatically collects and sends device data at the specified interval:
let config = SDKConfig(accountID: 123456, collectionIntervalSeconds: 300) // every 5 minutes
let tracker = DeviceTracker(config: config)
// Later, when done:
tracker.shutdown()Call shutdown() to cancel automatic collection and release resources:
tracker.shutdown()The SDK provides Objective-C compatible wrapper classes with an MM prefix.
@import MinFraudDevice;
MMSDKConfig *config = [[MMSDKConfig alloc] initWithAccountID:123456];
if (!config) {
// Handle invalid configuration
return;
}
MMDeviceTracker *tracker = [[MMDeviceTracker alloc] initWithConfig:config];
[tracker collectAndSendWithCompletion:^(MMTrackingResult *result, NSError *error) {
if (error) {
NSLog(@"Failed to send device data: %@", error);
return;
}
[self sendToBackend:result.trackingToken];
}];
// When done:
[tracker shutdown];The SDK collects the Identifier for Vendor (IDFV) and persists it in the Keychain. It does not use the Identifier for Advertisers (IDFA) or any tracking frameworks. A privacy manifest is bundled with the SDK.
The simulator destination in the commands below depends on your installed Xcode
version. To list available simulators, run xcrun simctl list devicetypes.
xcodebuild build -scheme MinFraudDevice -destination 'generic/platform=iOS Simulator'xcodebuild test -scheme MinFraudDevice -destination 'platform=iOS Simulator,name=iPhone 17'Run all linters and formatters via precious:
precious lint --allThis runs SwiftLint, yamllint, and prettier (for Markdown). You can also run them individually:
swiftlint lint
yamllint .
npx prettier --check --parser markdown --prose-wrap always "**/*.md"Generate API documentation with DocC:
xcodebuild docbuild -scheme MinFraudDevice -destination 'generic/platform=iOS Simulator' -derivedDataPath .build/doccA minimal SwiftUI example app is included at Example/MinFraudDeviceExample/.
Build it with:
xcodebuild build \
-project Example/MinFraudDeviceExample/MinFraudDeviceExample.xcodeproj \
-scheme MinFraudDeviceExample \
-destination 'platform=iOS Simulator,name=iPhone 17'- Fork the repository
- Set up your development environment (see SETUP.md)
- Create a feature branch
- Make your changes
- Run tests and code quality checks
- Submit a pull request
This software is Copyright (c) 2026 by MaxMind, Inc.
This is free software, licensed under the Apache License, Version 2.0 or the MIT License, at your option.
For support, please visit maxmind.com/en/company/contact-us.
If you find a bug or have a feature request, please open an issue on GitHub.