I'm trying to use Facebook SDK in Swift. It will compile and run in the Simulator and locally on my device. However, trying to Archive or build in the release configuration fails.
ld: bitcode bundle could not be generated because '/.../DerivedData/FacebookSwift-xyz/Build/Products/Release-iphoneos/FBSDKCoreKit.framework/FBSDKCoreKit'
was built without full bitcode. All frameworks and dylibs for bitcode must be
generated from Xcode Archive or Install build file '/.../DerivedData/FacebookSwift-xyz/Build/Products/Release-iphoneos/FBSDKCoreKit.framework/FBSDKCoreKit'
for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to reproduce
Download or clone the Facebook SDK in Swift project, edit the FacebookCore
scheme to build the release configuration.
Run Carthage to pull down the dependancies, facebook-ios-sdk et al.
Building the project will now give the error; bitcode bundle could not be generated because '.../FBSDKCoreKit' was built without full bitcode
Project Settings
- The
FBSDKCoreKit
target in the FBSDKCoreKit sub-project has "Enable Bitcode" set to "YES". - The
FacebookCore
target also has "Enable Bitcode" set to "YES". - The
FacebookCore
target has 2 target dependancies; Bolts and FBSDKCoreKit, both are the Dynamic framework versions.
Investigation
I have attempted to build the FBSDKCoreKit-Dynamic scheme (in Release config) and that succeeds. The resulting Framework has bitcode (as far as I can tell), running: otool -l "/path/to/framework-binary" | grep -c __LLVM
returns 4.
Running file
on the binary returns:
/.../FBSDKCoreKit.framework/FBSDKCoreKit: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O dynamically linked shared library arm_v7] [arm64:Mach-O 64-bit dynamically linked shared library arm64]
/.../FBSDKCoreKit.framework/FBSDKCoreKit (for architecture armv7): Mach-O dynamically linked shared library arm_v7
/.../Release-iphoneos/FBSDKCoreKit.framework/FBSDKCoreKit (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64
Tools etc
- Xcode 9.4.1
facebook-sdk-swift
is version 0.31facebook-ios-sdk
(Objective-C) is version 4.34- Carthage v0.30.1
- Deployment target; iOS 8.0 for Facebook frameworks
- Base SDK: iOS 11.4 (
Latest iOS
) - LLVM v9.0