Get iOS device UDID with public API
The library use *.mobileconfig file to get device information. You can read the documents by Apple to learn about.
- UDID
- IMEI
- ICCID (I can't got it but write in the documents by Apple)
- Products (Like: iPhone8,3)
- Version (Like: 14G60)
Sorry, I don't know.
- Use CocoaPods
pod 'MobileGestalt'
- Use Source, drag MobileGestalt to your project
Import
#import <MobileGestalt/MobileGestalt.h>
Add an unique URLScheme to your Info.plist.
Such as: mobilegestalt
MGSessionConfiguration *configuration = [MGSessionConfiguration defaultConfiguration];
configuration.port = 10418;
configuration.portOffset = 3; // Use port 10418~10421
configuration.port = 0; // Use random port
self.session = [MGSession sessionWithConfiguration:configuration];
// Create a custom request
MGRequest *request = [MGRequest request];
request.attributes = @[MGAttributeUDID, MGAttributeIMEI, MGAttributeICCID, MGAttributeVersion, MGAttributeProduct];
request.displayName = @"Title for Profile";
request.organization = @"Subtitle for Profile";
request.explain = @"Description for Profile";
request.identifier = @"com.unique.mobilegestalt";
// Create a signed request in remote
MGRequest *request = [MGRequest requestWithMobileConfigURL:aRemoteURL];
// Create a signed request in local
MGRequest *request = [MGRequest requestWithMobileConfigData:aNSData];
[self.session request:request completed:^(MGRequest *request, MGResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSLog(@"%@", response.data);
}
}];