Skip to content

Instantly share code, notes, and snippets.

@zooyf
Created October 17, 2017 10:06
Show Gist options
  • Save zooyf/43a202a2a09f4a848f9744be0add029f to your computer and use it in GitHub Desktop.
Save zooyf/43a202a2a09f4a848f9744be0add029f to your computer and use it in GitHub Desktop.
let cls = NSClassFromString("UMANUtil")
let deviceIDSelector = Selector("openUDIDString")
var deviceID: String? = nil
if(cls != nil && cls!.responds(to: deviceIDSelector)){
deviceID = (cls as? NSObjectProtocol)?.perform(deviceIDSelector).takeUnretainedValue() as? String
}
guard let jsonData = try? JSONSerialization.data(withJSONObject: ["oid":deviceID], options: JSONSerialization.WritingOptions.prettyPrinted) else {
print("Can't get UDID")
return false
}
print(String.init(data: jsonData, encoding: .utf8)!)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment