-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes macOS receipt validation fails, wrong MAC address used as device identifier #83
Comments
Workaround (relevant on macOS only): // validate
let result = AppReceiptValidator().validateReceipt(parameters: .default)
#if os(macOS)
if case .error(.incorrectHash, _, _) = result,
// validate with fallback
let fallbackParameters = self.makeCurrentReceiptValidationFallbackParameters() {
return AppReceiptValidator().validateReceipt(parameters: fallbackParameters)
}
#endif
// return result
return result
// …
#if os(macOS)
/// Returns receipt validation parameters using the legacy style of retrieving the device identifier (MAC address)
func makeCurrentReceiptValidationFallbackParameters() -> AppReceiptValidator.Parameters? {
guard let deviceIdentifierData = AppReceiptValidator.Parameters.DeviceIdentifier.getLegacyPrimaryNetworkMACAddress()?.data else { return nil }
return .default.with { params in
params.deviceIdentifier = .data(deviceIdentifierData)
}
}
#endif |
@hannesoid: Is this workaround still needed? If so, will it eventually be incorporated into the package itself when this issue is closed? |
Good question! I can't answer it because we unfortunately have no data collection in place to establish if this workaround still gets active for recovering issues.
With this uncertain situation it probably it would make sense to integrate it into the package in some way, or figure out why the primary mechanism for getting the MAC address fails to determine the correct one. If the issue is closed then it will be one of the two scenarios, either it will be because it's been integrated, or, because we somehow determined it's not needed or found a way to fix the primary issue (but I can't say we've been working on any of those tasks recently). |
Have successfully deployed this code to the Mac App Store:
|
@hannesoid Nicely commented code! Not asking to merge. I wanted to created awareness that internal macOS code is different to the sample given to developers. For years we used This change makes the code to match internal implementation. The question is: What do we want? Do we want code correctness or code match? The change might need to be tested with iMac Pro and Airplay 2 being actively used. Download app and see what mac address is matching. Alternatively mac mini might behave the same as the iMac Pro [2]. [1] https://web.archive.org/web/20190119090657/https://developer.apple.com/library/archive/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html |
Use IOKit for receipt validation. Drop usage of exit(173) no longer supported.
We have encountered at least one case where receipt validation failed on macOS for a user, but would have succeeded when using the primary MAC address retrieved the "old style" (before #79).
The text was updated successfully, but these errors were encountered: