1

从 Xcode11 开始,我们一直在从 CocoaPods 迁移到 SwiftPM。不幸的是,一些依赖项还没有 SwiftPM 支持。像火力基地

这不是一个真正的问题,因为它们可以彼此相邻共存。
但是自从(我认为 Firebase iOS SDK v6.13.0)他们添加了对PromisesObjC.
这本身不是问题,但我们的大多数项目(和(子)依赖项)都使用谷歌通过 SwiftPm 的承诺。

现在的问题是Promises SwiftPM 依赖项和Firebase CocoaPods 都使用FBLPromises,这将导致以下错误:

duplicate symbol '_FBLPromiseRetryDefaultAttemptsCount' in:
    /path/Products/Debug-iphonesimulator/FBLPromises.o
    /path/Products/Debug-iphonesimulator/PromisesObjC/libPromisesObjC.a(FBLPromise+Retry.o)
duplicate symbol '_FBLPromiseRetryDefaultDelayInterval' in:
    /path/Products/Debug-iphonesimulator/FBLPromises.o
    /path/Products/Debug-iphonesimulator/PromisesObjC/libPromisesObjC.a(FBLPromise+Retry.o)
duplicate symbol '_FBLWaitForPromisesWithTimeout' in:
    /path/Products/Debug-iphonesimulator/FBLPromises.o
    /path/Products/Debug-iphonesimulator/PromisesObjC/libPromisesObjC.a(FBLPromise+Testing.o)
duplicate symbol '_OBJC_CLASS_$_FBLPromise' in:
    /path/Products/Debug-iphonesimulator/FBLPromises.o
    /path/Products/Debug-iphonesimulator/PromisesObjC/libPromisesObjC.a(FBLPromise.o)
duplicate symbol '_OBJC_METACLASS_$_FBLPromise' in:
    /path/Products/Debug-iphonesimulator/FBLPromises.o
    /path/Products/Debug-iphonesimulator/PromisesObjC/libPromisesObjC.a(FBLPromise.o)
ld: 5 duplicate symbols for architecture x86_64

目前解决此问题的唯一方法是将Firebase CocoaPods depenceny 设置为v6.11.0

我当前的Podfile

source 'git@github.com:CocoaPods/Specs.git'

workspace 'Workspace'

platform :ios, '11.0'

use_modular_headers!
inhibit_all_warnings!

install! 'cocoapods',
    :generate_multiple_pod_projects => true,
    :incremental_installation => true

target 'HandpickedFamilyApp' do
    pod 'Firebase/Core'
    pod 'Firebase/RemoteConfig'
    pod 'Firebase/Analytics'
    pod 'Firebase/Performance'
    pod 'Fabric'
    pod 'Crashlytics'
    pod 'SwiftLint'

    script_phase :name => 'Run Fabric',
                :script => '"${PODS_ROOT}/Fabric/run"',
                :input_files => ['$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)']
end
4

1 回答 1

0

在将我的谷歌搜索词“cocoapods swiftpm 重复符号”更改为“cocoapods carthage 重复符号”后,我遇到了一个具有不同依赖关系的类似问题。
并且基本上忘记了所有关于use_frameworks!设置的事情。

将此添加到我的Podfile为我修复了它。

于 2020-01-31T10:38:08.833 回答