AdaSupport / ios-sdk

EmbedFramework is a small iOS SDK that is used to embed the Ada Chat bot into native iOS applications.
MIT License
4 stars 21 forks source link

XCFramework Support #38

Closed empowerMax closed 1 year ago

empowerMax commented 3 years ago

Hi 👋 , it'd be awesome if y'all could distribute an XCFramework as part of your releases.

Since the addition of arm simulators on the m1 Macs we've had build issues integrating the AdaEmbedFramework. For instance:

Module 'AdaEmbedFramework' was created for incompatible target arm64-apple-ios10.0-simulator: //app/Frameworks/AdaEmbedFramework.framework/Modules/AdaEmbedFramework.swiftmodule/arm64.swiftmodule

We work around this by building the Ada framework from source ourselves and stripping the arm64 flavour from frameworks for Simulator builds (by setting EXCLUDED_ARCHS). Given you're already supplying a fat framework as part of your releases, perhaps it won't be too much effort to supply an XCFramework.

Apple's doc about how to make one: https://help.apple.com/xcode/mac/11.4/#/dev544efab96 Or from the command line:

# Archive for iOS simulator (both intel and arm)
xcodebuild archive \
-scheme AdaEmbedFramework \
-destination "generic/platform=iOS Simulator" \
-archivePath <#output-path#>/ada-sim.xcarchive \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# Archive for iOS device (arm)
xcodebuild archive \
-scheme AdaEmbedFramework \
-destination "generic/platform=iOS" \
-archivePath  <#output-path#>/ada-device.xcarchive \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES

# Glue them together into an XCFramework
xcodebuild -create-xcframework \
-framework <#output-path#>ada-sim.xcarchive/Products/Library/Frameworks/AdaEmbedFramework.framework \
-framework <#output-path#>ada-device.xcarchive/Products/Library/Frameworks/AdaEmbedFramework.framework \
-output ./AdaEmbedFramework.xcframework
empowerMax commented 2 years ago

Hi @lujcheng any update on this or #26 ?

michaellazz commented 1 year ago

I've just released our first version of this as part of 1.8.0 https://github.com/AdaSupport/ios-sdk/releases/tag/1.8.0 going to close this since now we are including xcframework support :)