in "SystemConfiguration.framework" is a Function that seems to tell the MAC but has the "__IPHONE_NA" -> Not Available >>>>
CFStringRef
SCNetworkInterfaceGetHardwareAddressString (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
"<IOKit/network/IOEthernetController.h>" isn't available on iPhone, too.
in "SystemConfiguration.framework" is a Function that seems to tell the MAC but has the "__IPHONE_NA" -> Not Available >>>>
CFStringRef
SCNetworkInterfaceGetHardwareAddressString (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
"<IOKit/network/IOEthernetController.h>" isn't available on iPhone, too.
Please help me...
My router gave me mine.. but I guess you want it programatically?
I think it's buried deep in some network data structures. Look at the code in this post. It will run under the SDK. I think you can find the MAC address in the data structures that it queries.
I think the iPhone doesn't have a IPv6 Address ? I only get the IPv4 with this code ! And IPv6 is not the MAC-Address !?
I thought i can use the <in.h> like this >>
...
struct ifreq ifr;
...
a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
printf("%02x:%02x:%02x:%02x:%02x:%02x\n", a[0],a[1],a[2],a[3],a[4],a[5]);
...
but the <in.h> hasn't the "ifr_hwaddr" like Linux has !! ??
see this >> from my Mac !!!
struct ifreq {
#ifndef IFNAMSIZ
#define IFNAMSIZ IF_NAMESIZE
#endif
char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */
union {
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr;
short ifru_flags;
int ifru_metric;
int ifru_mtu;
int ifru_phys;
int ifru_media;
int ifru_intval;
caddr_t ifru_data;
struct ifdevmtu ifru_devmtu;
struct ifkpi ifru_kpi;
} ifr_ifru;
and this from Linux >>>
166 union {
167 struct sockaddr ifru_addr;
168 struct sockaddr ifru_dstaddr;
169 struct sockaddr ifru_broadaddr;
170 struct sockaddr ifru_netmask;
171 struct sockaddr ifru_hwaddr;
172 short ifru_flags;
173 int ifru_ivalue;
174 int ifru_mtu;
175 struct ifmap ifru_map;
176 char ifru_slave[IFNAMSIZ]; /* Just fits the size */
177 char ifru_newname[IFNAMSIZ];
178 void __user * ifru_data;
179 struct if_settings ifru_settings;
180 } ifr_ifru;
on my MAC (and iPhone) i'm missing the "ifr_hwaddr" !!
Yes, the phone has no IPv6 address, and the IPv6 address isn't the MAC address.
One other thought. On the Mac ifconfig can figure out the Mac address. The ifconfig source is opensource as part of Darwin. You can get it from this page:
I guess it's possible that ioctl is disabled as part of the sandbox.
Why do you want the machine's MAC address?
Maybe you need to use up one of your support incidents to figure this out.
Some time in the next week or so the NDA should be officially lifted by Apple and it should be possible to ask this kind of question on the Apple networking list and get an answer.
If you are using inforamation that is not documented in the SDK - that is you have pulled it from a header file instead - then you run the risk of being rejected.
You need to contact Apple diretly if you want an answer to this question.
If you are using inforamation that is not documented in the SDK - that is you have pulled it from a header file instead - then you run the risk of being rejected.
You need to contact Apple diretly if you want an answer to this question.
-t
Could you provide me with the right email address?
The only way I know to get an official answer to your question is to submit it to Developer Tech Support as one of your paid tech support requests.
You could ask on the Apple Developer Program Forums and get an unofficial reply from one of the Apple developers who monitor the forums, but I know of no other way to engage Apple officially for an answer to this type of question.
There is no public email address for free software development support requests at Apple that I am aware of, and no one except Apple can really answer your question about rejection over this approach.
If you can find someone who is willing to admit that they have this code running in an approved App, that would be a little more comforting - however it might be that they "slipped through the cracks" as well and simply did not get caught. Admitting in public that they are using an undocumented approach to answering the question might get their application reviewed again...
You could also simply develop the application and submit it for review - hoping it does not violate the Undocumented API portion of your Developer Agreement. I personally would not build an application around an undocumented constant found only in a header file without first getting an official position from Apple, however I know many others who would do so and simply take their chances.
You have to decide how much of a risk this is to you.