Sample code for obtaining mac address is different to internal implementation
Originator: | xhruso00 | ||
Number: | rdar://FB13661140 | Date Originated: | 28/2/2024 |
Status: | Open | Resolved: | |
Product: | macOS | Product Version: | 14.0 |
Classification: | Incorrect/Unexpected Behavior | Reproducible: | Always |
The sample code obtained different mac address to address that was used to validate the receipt. Due to this customer experiences unrecoverable issue with message that app is damaged. Airplay/reboot did not solve the problem. Sample code: https://developer.apple.com/documentation/appstorereceipts/validating_receipts_on_the_device Upon checking internal Apple implementation in AppleMediaServices.framework (+[AMSDevice macAddressData]) I have noticed differences that caused this problem: Sample Code if wantBuiltIn == CFBooleanGetValue(isBuiltIn) { return candidate } Internal Code if CFBooleanGetValue(isBuiltIn) == true { return candidate } else if wantBuiltIn == false { return candidate } else { //interface is not build in but we want build in continue } Another difference is: guard let service = io_service(named: "en0", wantBuiltIn: true) ?? io_service(named: "en1", wantBuiltIn: false) //instead of true ?? io_service(named: "en0", wantBuiltIn: false) Due to the difference I would even rename wantBuiltIn to shouldFailIfNotBuiltIn The same differences are also present in the new implementation (suspected that it will move to new framework) AMSCore::NetworkUtils::CopyInterfaceMACAddress(unsigned int) While technically the sample code is correct, it’s not what Apple is using behind the curtains.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!