C# 如何使用C从IOS设备获取IMEI#

C# 如何使用C从IOS设备获取IMEI#,c#,ios,.net,xamarin.ios,imei,C#,Ios,.net,Xamarin.ios,Imei,我需要使用C#读取IOS设备的IMEI 这在C#/Xamarin中可能吗? 或者,我是否可以使用其他值来标识设备?一些设备标识符现在无法从iOS的公共API获取: IMSI-国际移动用户身份(SIM卡号) IMEI-国际移动设备标识(设备ID) UDID-Apple iDevices的唯一设备标识符 MAC地址-媒体访问控制地址(网络地址) 请看这里: 如果您可以使用提供的任何ID,那么代码是Swift格式的,但是如果您使用C#/Xamarin,那么转换代码并不困难 希望这有帮助一些设备标识符

我需要使用C#读取IOS设备的IMEI

这在C#/Xamarin中可能吗?
或者,我是否可以使用其他值来标识设备?

一些设备标识符现在无法从iOS的公共API获取:

IMSI-国际移动用户身份(SIM卡号)

IMEI-国际移动设备标识(设备ID)

UDID-Apple iDevices的唯一设备标识符

MAC地址-媒体访问控制地址(网络地址)

请看这里:

如果您可以使用提供的任何ID,那么代码是Swift格式的,但是如果您使用C#/Xamarin,那么转换代码并不困难


希望这有帮助

一些设备标识符现在无法从iOS的公共API中获取:

IMSI-国际移动用户身份(SIM卡号)

IMEI-国际移动设备标识(设备ID)

UDID-Apple iDevices的唯一设备标识符

MAC地址-媒体访问控制地址(网络地址)

请看这里:

如果您可以使用提供的任何ID,那么代码是Swift格式的,但是如果您使用C#/Xamarin,那么转换代码并不困难


希望这有帮助

我也试图找到一种捕获IMEI的方法,但我相信这是不可能的。我解决这个问题的唯一方法就是使用这个代码,它返回序列号

 public class IosDevice 
 {
        [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);

        public string GetIdentifier()
        {
            string serial = string.Empty;
            uint platformExpert = IOServiceGetMatchingService(0, IOServiceMatching("IOPlatformExpertDevice"));

            if (platformExpert != 0)
            {
                NSString key = (NSString)"IOPlatformSerialNumber";
                IntPtr serialNumber = IORegistryEntryCreateCFProperty(platformExpert, key.Handle, IntPtr.Zero, 0);

                if (serialNumber != IntPtr.Zero)
                {
                    serial = NSString.FromHandle(serialNumber);
                }

                IOObjectRelease(platformExpert);
            }

            return serial;
        }
    }

我还试图找到一种捕获IMEI的方法,但我相信这是不可能的。我解决这个问题的唯一方法就是使用这个代码,它返回序列号

 public class IosDevice 
 {
        [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);

        public string GetIdentifier()
        {
            string serial = string.Empty;
            uint platformExpert = IOServiceGetMatchingService(0, IOServiceMatching("IOPlatformExpertDevice"));

            if (platformExpert != 0)
            {
                NSString key = (NSString)"IOPlatformSerialNumber";
                IntPtr serialNumber = IORegistryEntryCreateCFProperty(platformExpert, key.Handle, IntPtr.Zero, 0);

                if (serialNumber != IntPtr.Zero)
                {
                    serial = NSString.FromHandle(serialNumber);
                }

                IOObjectRelease(platformExpert);
            }

            return serial;
        }
    }

从设备上的应用程序内部或通过USB连接到设备的计算机?您的应用是否必须通过应用商店批准,或者是否可以使用私人API?否。该应用将上载到应用商店。我的应用程序需要每个使用应用程序登录到服务器的设备的ID…您可以使用供应商的
identifierForVendor
。你不能将IMEI用于应用商店应用。并非所有设备都有IMEI;例如,从设备上的应用程序中或从通过USB连接到设备的计算机中下载iPod和非手机iPad?您的应用是否必须通过应用商店批准,或者是否可以使用私人API?否。该应用将上载到应用商店。我的应用程序需要每个使用应用程序登录到服务器的设备的ID…您可以使用供应商的
identifierForVendor
。你不能将IMEI用于应用商店应用。并非所有设备都有IMEI;例如iPod和非手机iPad非常感谢,这是我搜索的内容非常感谢,这是我搜索的内容