gpt4 book ai didi

ios - 安装 adMob 横幅给我奇怪的 Mach-O 链接器错误

转载 作者:行者123 更新时间:2023-11-29 10:52:04 25 4
gpt4 key购买 nike

您好,我试图在我的应用中安装 adMob Ad,但 xcode 给我这个错误

ld: framework not found AudioUnit clang: error: linker command failed with exit code 1 (use -v to see invocation) ld: framework not found AudioUnit

audioUnit.framework 不是要添加(阅读我正在关注的教程),但它给了我 3 个错误,说我需要它,所以在添加但它给了我这个错误。这是横幅的代码

//.h
//admob
#import "GADBannerViewDelegate.h"
#import "GADBannerView.h"
#import "GADRequest.h"
@class GADBannerView, GADRequest;

@interface ArrayDetailViewController : UIViewController <ADBannerViewDelegate, GADBannerViewDelegate>
{
//admob
GADBannerView *bannerView_;
}
//admob
@property (nonatomic, retain) GADBannerView *adBanner;

//.m
//admob
@synthesize adBanner = adBanner_;

- (void)viewDidLoad
{
[super viewDidLoad];
//admob
self.adBanner = [[GADBannerView alloc]
initWithFrame:CGRectMake(0,self.view.bounds.size.width-66,self.view.bounds.size.height,66)];
self.adBanner.adUnitID = @"pub-5290085476815648";
self.adBanner.delegate = self;
[self.adBanner setRootViewController:self];
[self.view addSubview:self.adBanner];
//self.adBanner.center = CGPointMake(self.view.center.x, self.adBanner.center.y);
GADRequest *r = [[GADRequest alloc] init];
r.testing = YES;
[self.adBanner loadRequest:r];
}

//admob
- (void)adViewDidReceiveAd:(GADBannerView *)adView
{
NSLog(@"Received ad successfully");
}

- (void)adView:(GADBannerView *)view didFailToReceiveAdWithError:(GADRequestError *)error
{
NSLog(@"Failed to receive ad with error: %@", [error localizedFailureReason]);
}

enter image description here

最佳答案

AdMob 需要以下框架:

  • StoreKit.framework
  • AdSupport.framework
  • AudioToolbox.framework
  • CoreGraphics.framework
  • MediaPlayer.framework
  • MessageUI.framework
  • SystemConfiguration.framework
  • 添加框架选择您的 XCode 项目 -> 选择目标 -> 构建阶段 -> 将二进制文件与二进制文件链接

    enter image description here

    确保您还添加了其他链接器标志“-ObjC”

    选择您的 XCode 项目 -> 选择目标 -> build设置 -> 搜索其他链接器标志

    enter image description here

    关于ios - 安装 adMob 横幅给我奇怪的 Mach-O 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20003114/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com