'How to exclude XCFramework from Catalyst?
Given that
There is an iOS app that needs Analytics and it's decided to use Amazon as a provider. So I added Amplify, and it works ok on iOS and on Simulator. But when building for Mac Catalyst, compiler produces a set of similar errors related to various XCFrameowrk's from Amplify bundle:
While building for Mac Catalyst, no library for this platform was found in '... artifacts/AWSiOSSDKV2/AWSCore.xcframework'.
Quick search shows that Amazon do not want to support Catalyst due to business reasons and there an open issue on this topic, and the first PR was raised 3 years ago then accidentally closed.
Attempts to avoid the error
Analytics isn't absolutely necessary feature, so I tried to remove Amplify libraries from Catalyst and keep them on iOS. I'm using this macro (which obviously is compile-time, not build-time, but some SO answers reported that it may help):
#if !TARGET_OS_MACCATALYST
import Amplify
import AWSPinpointAnalyticsPlugin
import AWSCognitoAuthPlugin
#endif
Then in Link Binary With Libraries I set Amplify-related libs to be Optional. In Filter section I removed checkmarks near Mac Catalyst, thinking that it will make them iOS-only:
All this tricks combined together didn't help and I'm still getting the same errors.
Q
How to exclude XCFramework for certain unsupported platforms?
P.S.
Seems, like a new AWS SDK, which claims to support Catalyst, is emerging. But it's raw and low level, and I simply not ready to debug it and build my own Analytis framework on top of it in scope of this question.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

