如何以编程方式获取iOS设备MAC地址 [英] How to get iOS device MAC address programmatically

查看:233
本文介绍了如何以编程方式获取iOS设备MAC地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的应用程序中以编程方式获取iOS设备的MAC代码?

How do I get an iOS device's MAC code programmatically in my app?

推荐答案

现在iOS 7设备 - 始终返回的地址是02:00:00:00:00:00。

Now iOS 7 devices – are always returning a MAC address of 02:00:00:00:00:00.

所以最好使用 [UIDevice identifierForVendor ]

因此,最好将此方法称为应用特定的唯一键

类别更合适

#import "UIDevice+Identifier.h"

- (NSString *) identifierForVendor1
{
    if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) {
        return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
    }
    return @"";
}

现在调用上述方法获取唯一地址

NSString *like_UDID=[NSString stringWithFormat:@"%@",
                [[UIDevice currentDevice] identifierForVendor1]];

NSLog(@"%@",like_UDID);

这篇关于如何以编程方式获取iOS设备MAC地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆