dyld:库未加载:@rpath/GoogleUtilities.framework/GoogleUtilities

dyld: Library not loaded: @rpath/GoogleUtilities.framework/GoogleUtilities

我真的需要一些帮助来解决一个让我发疯的问题...

这是关于 运行在设备上安装我的应用程序(因为问题没有出现在模拟器上),我无法找到解决它的方法,即使阅读并尝试了所有的解决方案网站。

一旦我 运行 应用程序,它在启动期间冻结,下一条消息出现在调试区域:

dyld: Library not loaded: @rpath/GoogleUtilities.framework/GoogleUtilities
  Referenced from: /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/SmiliPRO
  Reason: no suitable image found.  Did find:
    /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: code signature invalid for '/private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities'

    /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: stat() failed with errno=25
    /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: code signature invalid for '/private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities'

    /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: stat() failed with errno=1
    /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: code signature invalid for '/private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities'

    /private/var/containers/Bundle/Application/2C9EB539-D6BA-4291-A62C-4C3A438483CF/SmiliPRO.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: stat() failed with errno=1
(lldb)

然后,在主屏幕上出现:

还有这个:

我正在使用 Xcode 11.3.1

关于我是如何添加框架的,它使用的是 Cocoapods 1.8.4。这是我关于 Google:

的 Podfile
target 'SmiliPRO' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  pod 'Google-Mobile-Ads-SDK'

然后,下面是我使用 Google 做广告的方式:

import UIKit
import GoogleMobileAds

class ViewController: UIViewController,
GADBannerViewDelegate {
    @IBOutlet weak var bannerView: GADBannerView!

    override func viewDidLoad() {
        super.viewDidLoad()
        //AdMob del Banner
        bannerView.adUnitID = "ca-app-pub-3940256099942544/2934735716"
        bannerView.delegate = self
        bannerView.rootViewController = self
        bannerView.load(GADRequest())
    }

关于嵌入式二进制文件,我只有这个选项应该是:

如果我在此处添加GoogleUtilities.framework,则在构建过程中会出现下一个错误...

Multiple commands produce '/Users/nachoimac/Library/Developer/Xcode/DerivedData/SmiliPRO-dscwzgjxgxtpzsbkzznkjquojuhz/Build/Products/Debug-iphoneos/SmiliPRO.app/Frameworks/GoogleUtilities.framework':
1) Target 'SmiliPRO' has copy command from '/Users/nachoimac/Library/Developer/Xcode/DerivedData/SmiliPRO-dscwzgjxgxtpzsbkzznkjquojuhz/Build/Products/Debug-iphoneos/GoogleUtilities.framework' to '/Users/nachoimac/Library/Developer/Xcode/DerivedData/SmiliPRO-dscwzgjxgxtpzsbkzznkjquojuhz/Build/Products/Debug-iphoneos/SmiliPRO.app/Frameworks/GoogleUtilities.framework'
2) That command depends on command in Target 'SmiliPRO': script phase “[CP] Embed Pods Frameworks”

我也试过在Podfile中注释掉use_frameworks,出现了一个新的错误:

/Users/nachoimac/Library/Developer/Xcode/DerivedData/SmiliPRO-dscwzgjxgxtpzsbkzznkjquojuhz/Build/Products/Debug-iphoneos/Pods_SmiliPRO.framework: No such file or directory

不知道关键是不是在原来的报错信息中出现了类似“code signature invalid for”之类的东西,可以这样吗?

提前致谢!

我在 模拟器 上 运行 时遇到了这个问题,但我的设备上没有。问题是我的 MacBook 上的 CylanceProtect 防病毒软件阻止了 GoogleUtilities 文件:

我联系了我公司的安全专家,他在政策中添加了豁免,因此该文件不再被隔离。现在应用程序在模拟器上运行良好。

您可能会检查您的设备是否装有 运行 CylanceProtect 或其他一些防病毒软件。我花了3天时间才发现这个问题的原因。