Undefined symbol: type metadata for Swift._StringObject.Variant

While trying to build our project with Xcode 12 I ran into multiple build failures while rebuilding our dependencies with Carthage.

I always end up getting this linker error:


Undefined symbols for architecture armv7: "type metadata for Swift.StringObject.Variant", referenced from: outlined init with take of Swift.StringObject.Variant in CountryCodePickerViewController.o ld: symbol(s) not found for architecture armv7

This happened for me for both Alamofire and PhonenumerKit; therefore, this looks like an issue with the new Xcode and not the frameworks themselves. Archiving them with Xcode 11 works without a problem.

As an intermediate workaround I removed the armv7 architecture from the valid architectures.


Replies

I encountered the same in the Appolo GraphQL client. tried removing other than arm64 in valid architecture. but no luck still the error is present
Searched across workspace "IPHONEOSDEPLOYMENTTARGET" and set it to 9.0
Updated Valid Architecture by keeping only 64 bit support
These 2 changes end up resolving this issue for my application codebase.
In my podfile, I just added this to make everything compatible to Xcode 12

Code Block
target.build_configurations.each do |config|
    config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
    if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] == '8.0'
     config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
    config.build_settings['ARCHS'] = '$(ARCHS_STANDARD_64_BIT)'
   end



You need to added after

Code Block
post_install do |installer|
  installer.pods_project.targets.each do |target|

This still reproduces with Xcode 12 beta 2 for me.
And still reproduces on Xcode 12 b3 for me.
Same issues on Xcode 12 beta 3 as well. Archived by removing armv7 from Pods.
I got same issues on Xcode 12 beta 3.
I fixed it by going to the Build Settings for Lottie-ios Deployment and changed the iOS Deployment Target to iOS 13
The issue is still present on Xcode 12 beta 3.

A (workaround) solution for certain cases of the problem could be resolved by replace any usage of the #.split with #.components on a String.

https://developer.apple.com/documentation/swift/string/2894564-split
https://developer.apple.com/documentation/foundation/nsstring/1413214-components
Another case I came across is the usage of String variables in struct, when replaced with class this issue is no longer present. But these changes are quite undesired, but suffice while we wait for the problem to be resolved.
I really hope this issue gets resolved soon. With Carthage we can use prebuild libraries with minimal affet to project compile time. Using Swift Package Manager we would dramatically increase our already long build times.
And still reproduces on Xcode 12 Beta 5 for me.