Reputation: 5896
We are trying to integrate TikTokOpenSDK.frameowork
(https://developers.tiktok.com/doc/ios_quickstart) within our custom Swift Package
.
TikTok only gives us .framework
access (you can download it manually). So far I've failed to integrate it, no matter what combination I'm trying, it fails with unsupported extension for binary target ‘TikTokOpenSDK’; valid extensions are: xcframework
:
Any help will be highly appreciated. Thank you!
Upvotes: 7
Views: 4203
Reputation: 2383
Swift Package Manager only supports XCFrameworks. Your only option is to convert your classic framework into an XCFramework. I've done this in the past for the SendbirdSDK and everything worked out okay (though I can't give a full guarantee this will work for TikTok!). The gist of the process is that you want to create the XCFramework structure as described here. Note that this was reverse engineered and so is subject to change.
This will involve quite a few folders if you want to make slices as compact as possible, but if you don't care at all and just need it to run on the simulator and on iOS devices the follow tree works:
TikTokOpenSDK.xcframework
- Info.plist
- universal-simulator
- TikTokOpenSDK.framework
- universal-hardware
- TikTokOpenSDK.framework
And then the aforementioned Info.plist
should contain:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>LibraryIdentifier</key>
<string>universal-simulator</string>
<key>LibraryPath</key>
<string>TikTokOpenSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>universal-hardware</string>
<key>LibraryPath</key>
<string>TikTokOpenSDK.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>armv7k</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
</plist>
Once you've created this structure (and dropped in the original framework directly), you should be able to include this XCFramework in an SPM and it should work as expected!
Upvotes: 10