[操作系统]iOS开发之使用CocoaPods更新第三方出现“target overrides the `OTHER_LDFLAGS`……”问题解决方案

本文记录了在项目中使用CocoaPods引入SDWebImage遇到的问题及解决过程。主要介绍了解决因`OTHER_LDFLAGS`导致的警告和运行错误的方法。

 今天在自己的项目中用CocoaPods引入第三方SDWebImage的时候,出现了问题。当更新完毕后,在终端没太注意这个问题的提示,就直接使用SDWebImage了,在使用的时候一些方法的提示和头文件都能引入和使用(看上去SDWebImage可以正常使用),可是一运行就报错(错误是下面给出的错误)。貌似是程序写的有问题,然后就检查程序代码,可是检查不出任何错误,折腾了半天,然后就猛然想起pod update时报的错误。下面就写篇博客来纪念一下这个bug~

  1.引入第三方库的时候,在终端上会显示下面的警告,是警告(黄叹号吗),当时我就没太在意!感觉出现警告应该能正常运行的~警告如下(主要是下面的俩个):

 

  2.如果不解决的直接用第三方的话,程序中会出现下面的错误:

 

  3.然后就在程序中调啊~调啊~还是没调好,于是就解决黄叹号,解决步骤如下:

    (1)打开工程所在文件夹,找到.xcodeproj的文件,然后显示包内容,找到project.pbxproj文件,如下:

    (2)用文本编辑器打开,然后查找`OTHER_LDFLAGS`这个东西,把有关这个东西的地方都删掉(应该有四处),如下图:

    (3)删除完以后,在终端重新update一下,如下(就没有下面两个黄叹号了,解决完毕)

    (4)在编译运行我们的工程,编译通过~

[!] 'AppLovinMediationUnityAdsAdapter' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseAppCheckInterop' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseAuth' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseAuthInterop' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseCore' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseCoreExtension' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseCoreInternal' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'FirebaseInstallations' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'Fyber_Marketplace_SDK' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'GTMSessionFetcher' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'GoogleUtilities' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'PromisesObjC' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'RecaptchaInterop' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'Singular-SDK' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] 'nanopb' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue. [!] The `Unity-iPhone [Release]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [Release]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [ReleaseForProfiling]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.releaseforprofiling.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [ReleaseForProfiling]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.releaseforprofiling.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [ReleaseForRunning]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.releaseforrunning.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [ReleaseForRunning]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.releaseforrunning.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [Debug]` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.debug.xcconfig'. This can lead to problems with the CocoaPods installation - Use the `$(inherited)` flag, or - Remove the build settings from the target. [!] The `Unity-iPhone [Debug]` target overrides the `LD_RUNPATH_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-Unity-iPhone/Pods-Unity-iPhone.debug.xcconfig'. This can lead to problems with the CocoaPods installation
08-09
CocoaPods安装时,`Unity - iPhone`目标覆盖`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`构建设置可能导致安装问题,可采用以下两种解决方法: #### 方法一:使用`$(inherited)`标志 将`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`设置为`$(inherited)`,这样目标会继承来自`Pods/Target Support Files/Pods - Unity - iPhone/Pods - Unity - iPhone.*.xcconfig`文件中的设置。具体操作步骤如下: 1. 打开`Unity - iPhone.xcodeproj`项目。 2. 选择`Unity - iPhone`目标。 3. 切换到`Build Settings`选项卡。 4. 找到`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`设置项。 5. 将其值修改为`$(inherited)`。 #### 方法二:移除目标中的构建设置 直接移除`Unity - iPhone`目标里的`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`设置,让其使用`Pods`配置文件中的默认设置。操作步骤如下: 1. 打开`Unity - iPhone.xcodeproj`项目。 2. 选择`Unity - iPhone`目标。 3. 切换到`Build Settings`选项卡。 4. 找到`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`设置项并删除。 另外,还可以分别选中`Unity - iPhone`和`UnityFramework`的`Build Settings`选项,将`Always Embed Swift Standard Libraries`设置为`No`,这也可能有助于解决问题。 以下是一个简单的示例代码,模拟了修改构建设置的操作(实际中需要在Xcode界面操作): ```python # 此代码仅为示例,不直接对应上述操作 # 假设模拟修改构建设置 def fix_build_settings(): # 模拟设置为$(inherited) set_always_embed_to_inherited() # 模拟移除构建设置 remove_build_settings() def set_always_embed_to_inherited(): print("设置ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES为$(inherited)") def remove_build_settings(): print("移除目标中的构建设置") fix_build_settings() ```
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值