Skip to content

Instantly share code, notes, and snippets.

@igroomgrim
Created January 22, 2021 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igroomgrim/095202c2455d0de10e93430968fb2827 to your computer and use it in GitHub Desktop.
Save igroomgrim/095202c2455d0de10e93430968fb2827 to your computer and use it in GitHub Desktop.
Build Omise iOS SDK .xcframework
This workaround let we can build `OmiseSDK.xcframework` and just copy into your project
- **Environments**
- Xcode 12.3 (12C33)
- Swift 5.3.1
------------
- **Steps**
1. Download Omise SDK ([master](https://github.com/omise/omise-ios/archive/master.zip)) and extract into your PC
2. Open `Terminal` app and go to `omise-ios-sdk` folder
3. use `xcodebuild` archive SDK for simulator
```
xcodebuild archive \
-scheme OmiseSDK \
-archivePath ~/YourOutputLocation/OmiseSDK-iphonesimulator.xcarchive \
-sdk iphonesimulator \
SKIP_INSTALL=NO \
BITCODE_GENERATION_MODE=bitcode \
OTHER_CFLAGS="-fembed-bitcode" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
ONLY_ACTIVE_ARCH=NO
```
4. use xcodebuild archive SDK for devices
```
xcodebuild archive \
-scheme OmiseSDK \
-archivePath ~/YourOutputLocation/OmiseSDK-iphoneos.xcarchive \
-sdk iphoneos \
SKIP_INSTALL=NO \
BITCODE_GENERATION_MODE=bitcode \
OTHER_CFLAGS="-fembed-bitcode" \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
ONLY_ACTIVE_ARCH=NO
```
5. combine them both in `xcframework`
```
xcodebuild -create-xcframework \
-framework ~/YourOutputLocation/OmiseSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/OmiseSDK.framework \
-framework ~/YourOutputLocation/OmiseSDK-iphoneos.xcarchive/Products/Library/Frameworks/OmiseSDK.framework \
-output ~/YourOutputLocation/OmiseSDK.xcframework
```
6. drag and drop `OmiseSDK.xcframework` into your application project and select `Copy items if needed`
7. in app targets `Frameworks, Libraries, and Embeded content` choose `Embed & Sign`
🙇
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment