using System; using System.Runtime.InteropServices; using TINK.Model.Device; [assembly: Xamarin.Forms.Dependency(typeof(TINK.iOS.Device.Device))] namespace TINK.iOS.Device { public class Device : IDevice { [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] private static extern uint IOServiceGetMatchingService(uint masterPort, IntPtr matching); [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] private static extern IntPtr IOServiceMatching(string s); [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] private static extern IntPtr IORegistryEntryCreateCFProperty(uint entry, IntPtr key, IntPtr allocator, uint options); [DllImport("/System/Library/Frameworks/IOKit.framework/IOKit")] private static extern int IOObjectRelease(uint o); /// Gets unitque device identifier. /// Gets the identifies specifying device. public string GetIdentifier() { return UIKit.UIDevice.CurrentDevice?.IdentifierForVendor?.AsString() ?? string.Empty; } } }