phrase / ios-sdk

Phrase Over the Air iOS SDK
https://phrase.com
Other
14 stars 3 forks source link

Compile with Xcode 12 Apple Swift version 5.3 #21

Closed mattiriihimaki closed 4 years ago

mattiriihimaki commented 4 years ago

I'm getting an error while trying to compile my project.

Failed to build module 'PhraseSDK' from its module interface; the compiler that produced it, 'Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)', may have used features that aren't supported by this compiler, 'Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)'

winkelsdorf commented 4 years ago

Hello @mattiriihimaki,

I just re-verfied the SDK 2.3.1 pod to be working with Xcode 12 on iOS 13.5 and 14.0. Could you please provide more details about your setup? Are you using Carthage by any chance?

The above error should not happen, as the SDK is compiled with "Build library for distribution" (a.k.a. Module Stability). Iirc Carthage has known issues with Xcode 12 so that's probably something you are running into? Could you try using CocoaPods 1.9.3?

mattiriihimaki commented 4 years ago

I'm using the CocoaPod 1.9.3 and 2.3.1 PhraseSDK

Build to a device or to "Any iOS Device" works but building for a simulator fails.

"unable to load standard library for target 'arm64-apple-ios9.0'"

winkelsdorf commented 4 years ago

@mattiriihimaki The error is very likely related to your project file and CocoaPods way of linking framework architectures. As to my knowledge Xcode never had any ARM64 simulator, but the simulator is always x86_64 (but there are Simulators with ARM64 for Apple Silicon now). So the reference to the standard library arm64-apple-ios9.0 is never right for the iOS 9.0 Simulator.

Please see https://stackoverflow.com/questions/63342162/cannot-build-project-with-xcode-12-0-beta-5 for the same error with the previous Xcode beta 5.

When I ran into this myself I had to remove the VALID_ARCHS from the project build settings, run pod deintegrate and pod install together with cleaning derived data afterwards and doing a clean build.

If this does not help: What macOS Version are you using? There are known issues with the current Big Sur Beta related to Xcode 12.

mattiriihimaki commented 4 years ago

Yea, I was able to fix the problem with this https://stackoverflow.com/questions/63607158/xcode-12-building-for-ios-simulator-but-linking-in-object-file-built-for-ios. So, this had nothing to do with your SDK. Sorry and thank you for the help :)

winkelsdorf commented 4 years ago

@mattiriihimaki You're welcome and thank you for your feedback! I am glad to hear that I was able to point in the right direction. No problem, sometimes it' s difficult to find out where problems have their origins. Especially with Xcode 12 😅

scannillo commented 3 years ago

👋 While the solution @mattiriihimaki linked gets things working, it doesn't seem like an ideal long term solution since it won't allow simulator builds to run on an M1 mac. Do you have ideas for a solution beside excluding arm_64 simulator archs from the podspec?

winkelsdorf commented 3 years ago

Hi @scannillo,

the mentioned workaround is not be necessary anymore, a fully M1/arm64 compatible release was published in January 2021. Just install the latest version e.g. via CocoaPods (please update CocoaPods itself too), SwiftPM or the see latest releases https://github.com/phrase/ios-sdk/releases when installing manually.

Feel free to open a new issue if you have any issues or troubles getting this working.

Hope that helps!