How can I programmatically get the MAC address of an iphone

后端 未结 12 2166
春和景丽
春和景丽 2020-11-22 08:06

How to programmatically get an iPhone\'s MAC address and IP address?

12条回答
  •  误落风尘
    2020-11-22 08:30

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

    So better use [UIDevice identifierForVendor].

    so better to call this method to get app specific unique key

    Category will more suitable

    import "UIDevice+Identifier.h"

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

    Now call above method to get unique address

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

提交回复
热议问题