【发布时间】:2021-08-01 01:40:29
【问题描述】:
这不是重复的。我搜索了所有类似的问题,但没有一个有效。
示例错误消息:
objc[58549]: Class GADGestureRecognizer is implemented in both
/Users/[my_user_name]/Library/Developer/Xcode/DerivedData/Everything-ehqjadneufaqbxgjgtsglecahoeq/Build/Products/Debug-iphonesimulator/LibApp.framework/LibApp (0x11002c038) and
/Users/[my_user_name]/Library/Developer/CoreSimulator/Devices/85D95107-C3D8-47DA-9717-BA16098F1DF5/data/Containers/Bundle/Application/92DB4924-80B3-42B4-AC6E-6BF774089C7A/BinTesting.app/BinTesting (0x10a2e9300).
One of the two will be used. Which one is undefined.
上面的一个有趣的注释是第一个路径在构建缓存下(Xcode/DerivedData),第二个在应用程序包下(CoreSimulator/Devices/...)。这可能是解决问题的关键,但我不知道答案。
这是我的 pod 文件:
platform :ios, '14.4'
workspace 'Everything'
use_frameworks!
##########
# Dependencies
##########
def admob
pod 'Google-Mobile-Ads-SDK'
end
def rn_cryptor
pod 'RNCryptor'
end
##########
# Framework Targets
##########
def framework_pods
admob
rn_cryptor
end
target 'LibApp' do
project 'Libraries/LibApp/LibApp.xcodeproj'
admob
rn_cryptor
end
##########
# App Targets
##########
target 'BinTesting' do
project 'Binaries/BinTesting/BinTesting.xcodeproj'
# The app target must include all pods (https://github.com/CocoaPods/CocoaPods/issues/5316)
framework_pods
end
在上面,BinTesting 是应用程序二进制文件,它依赖于LibApp。
LibApp 是一个内部库,包含(取决于)admob
在我的项目设置中,BinTesting 嵌入了所有内容。并且LibApp 没有嵌入admob pod。
我尝试了以下方法,但没有成功:
CocoaPods use_frameworks! causes "Class X is implemented in both Y and Z"
Cocoapods: Class XX is implemented in both
Firebase Class FIRAAppEnvironmentUtil is implemented in both when using Cocoapods
Class is implemented in both, One of the two will be used. Which one is undefined
https://medium.com/@GalvinLi/tinysolution-fix-cocoapods-duplicate-implement-warning-5a2e1a505ea8
【问题讨论】: