swiftxcodecocoapodsxcode11.3

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


I really need some help in a problem which is turning me crazy...

It's about running my app on a device (because the problem doesn't appear on the simulator) and I can't find what how to solve it even reading and trying all the solution along this website.

Once I run the app, it freezes during launching an the next message appear on the debug area:

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)

Then, on the main screen appears this:

enter image description here

And this:

enter image description here

I'm using Xcode 11.3.1

About how I've added the framework, it was using Cocoapods 1.8.4. Here is my Podfile concerning Google:

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

Then, here is how I'm using Google for Ads:

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())
    }

Concerning the Embedded Binaries, I only have this option where it should be:

enter image description here

If I add here GoogleUtilities.framework, the next error appears during building...

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”

I've also tried to comment out use_frameworks into Podfile, a new error appears:

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

I don't know if the key is that in the original error message appear something like "code signature invalid for", could this be?

Thank you in advance!


Solution

  • I had this problem when running on the simulator, but not on my device. The problem is that CylanceProtect antivirus software on my MacBook was blocking the GoogleUtilities file:

    CylanceProtect quarantine

    I contacted my company's security expert and he added a waiver to the policy so that this file is no longer quarantined. Now the app runs fine on the simulator.

    You might check if your device is running CylanceProtect or some other antivirus software. It took me 3 days to discover the cause of this problem.