tikhop / TPInAppReceipt

Reading and Validating In App Purchase Receipt Locally.
MIT License
631 stars 93 forks source link

Build failed for iOS Simulator #99

Closed ghost closed 1 year ago

ghost commented 2 years ago

When building for any iOS simulator on an M1 Mac, the following error occurs:

Could not find module 'TPInAppReceipt' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at: /Users/wizfinger/Library/Developer/Xcode/DerivedData/appname-bkfhgmponcvrxfawozdvxtgsikwn/Build/Products/Debug-iphonesimulator/TPInAppReceipt.swiftmodule

(TPInAppReceipt_Objc has the same result).

Build for device works correctly.

What can I do to fix this?

tikhop commented 2 years ago

@Wizfinger Unfortunately, I don't have m1 mac, but based on error it seems you are running x86_64 simulator (maybe rosetta is turned on). It compiles for arm64-apple which is m1, but you are asking for x86_64

ghost commented 2 years ago

Thanks I’ll have a look here: https://stackoverflow.com/questions/56957632/could-not-find-module-for-target-x86-64-apple-ios-simulator

looks like it can be fixed by adding some settings in the podspec or the swift package manager.

ghost commented 2 years ago

While experimenting, I have found more details:

TPInAppReceipt-Objc.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
TPInAppReceipt.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64
ASN1Swift.o, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-arm64

As per this answer, support for arm64 Simulator slices on M1 Macs should be added in order to allow building for the Simulator.

tikhop commented 2 years ago

@Wizfinger I'm sorry for the delay, I've been traveling for the last two weeks and will be able to check it out in a week. If you know how to fix it — feel free to make a PR. Thank you.