I tried SwiftStoreKit & TPInAppReceipt in running iOS app to M1 mac book, it does not work.
I try to run my app in mac, finish the purchase process, and rerun it to see if it passes local receipt validation. But in this situation, my receipt file name is 'sandboxReceipt', however, the path 'Bundle.main.appStoreReceiptURL' returns 'receipt', hence the appStoreReceiptData returns by SwiftStoreKit is nil.
so I download my app by app store, finish the purchase process. My app version of App Store using SwiftStoreKit & OpenSSL to validate receipt, i reopen the download app, the local receipt validation fails, which is expected.
now i got both the sandboxReceipt & receipt, so i run my app with Xcode in mac again. Now i got the receipt data, and enter the validation process in TPInAppReceipt, and the validation failed.
I notice in the 'guid' method, it actually runs the same block as in iOS device. I guess the expected result is to run the last block.
Code Block swiftfileprivate func guid() -> Data |
{ |
|
#if os(watchOS) |
var uuidBytes = WKInterfaceDevice.current().identifierForVendor!.uuid |
return Data(bytes: &uuidBytes, count: MemoryLayout.size(ofValue: uuidBytes)) |
#elseif !targetEnvironment(macCatalyst) && (os(iOS) os(tvOS)) |
var uuidBytes = UIDevice.current.identifierForVendor!.uuid <---------------------- code runs here! |
return Data(bytes: &uuidBytes, count: MemoryLayout.size(ofValue: uuidBytes)) |
#elseif targetEnvironment(macCatalyst) os(macOS) |
|
var masterPort = mach_port_t() |
var kernResult: kern_return_t = IOMasterPort(mach_port_t(MACH_PORT_NULL), &masterPort) |
... |
#endif |
} |
Here is my debug information:
Code Block swiftlet device = UIDevice.current |
log.info([ |
"=== Device Information ===", |
"Name: \(device.name)", |
"System Name: \(device.systemName)", |
"System Version: \(device.systemVersion)", |
"Model: \(device.model)", |
"Localized Model: \(device.localizedModel)", |
].joined(separator: "\n")) |
|
/* output: |
=== Device Information === |
Name: Alen’s MacBook Pro 13 |
System Name: iOS |
System Version: 14.2 |
Model: iPad |
Localized Model: iPad |
*/ |