当前,我正在尝试使用AdMob。在模拟器上,一切正常,但是当我想在真实设备上测试我的应用程序时,该应用程序崩溃了。希望任何人都能帮助我。我添加了带有cocoapods的Google-Mobile-Ad SDK,但在任何地方都找不到我的问题的答案
CrashLog:
Referenced from: /private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/App
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: code signature invalid for '/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities'
/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: stat() failed with errno=25
/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: code signature invalid for '/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities'
/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: stat() failed with errno=1
/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: code signature invalid for '/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities'
/private/var/containers/Bundle/Application/4CEB0B87-F7C8-4B85-A6BA-B6B97CB94950/App.app/Frameworks/GoogleUtilities.framework/GoogleUtilities: stat() failed with errno=1
横幅:
import SwiftUI
import GoogleMobileAds
import UIKit
final private class BannerVC: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
let view = GADBannerView(adSize: kGADAdSizeBanner)
let viewController = UIViewController()
view.adUnitID = "ca-app-pub-3940256099942544/2934735716"
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers =
[ "kGADSimulatorID" ] // Sample device ID
view.rootViewController = viewController
viewController.view.addSubview(view)
viewController.view.frame = CGRect(origin: .zero, size: kGADAdSizeBanner.size)
view.load(GADRequest())
return viewController
}
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}
struct BannerMenu:View{
var body: some View{
HStack{
Spacer()
BannerVC().frame(width: 320, height: 50, alignment: .center)
Spacer()
}
}
}
struct BannerMenu_Previews: PreviewProvider {
static var previews: some View {
BannerMenu()
}
}