gpt4 book ai didi

ios - 使用 admob 时出现 apple mach-o 链接器错误

转载 作者:可可西里 更新时间:2023-11-01 03:36:24 26 4
gpt4 key购买 nike

我创建了一个测试项目来测试 admob 并学习如何使用它,但是当我构建我的项目时,当我尝试将 admob 添加到我的项目(Xcode 4.3.3)中时,出现 11 个 apple mach-o 链接器错误

h文件可以,这里是M文件(代码取自admob知识库)

#import "chViewController.h"

#define MY_BANNER_UNIT_ID @"my id is written in here"

@interface chViewController ()

@end

@implementation chViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}

- (void)viewDidLoad {
[super viewDidLoad];

// Create a view of the standard size at the top of the screen.
// Available AdSize constants are explained in GADAdSize.h.
bannerView_ = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];

// Specify the ad's "unit identifier." This is your AdMob Publisher ID.
bannerView_.adUnitID = MY_BANNER_UNIT_ID;

// Let the runtime know which UIViewController to restore after taking
// the user wherever the ad goes and add it to the view hierarchy.
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];
}


- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}

错误

Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithName", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilitySetCallback", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[GADNetworkChecker stopNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADIdentifierUtilities.o)
"_AudioServicesPlaySystemSound", referenced from:
-[GADWebViewDelegate webView:shouldStartLoadWithRequest:navigationType:] in libGoogleAdMobAds.a(GADWebViewDelegate.o)
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_OBJC_CLASS_$_MFMailComposeViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_OBJC_CLASS_$_MFMessageComposeViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已将 lib.googleadmobAds 添加到我的文件夹并将二进制文件与库链接(当我删除它时,我收到相同的错误,但其中 4 个不是 11 个)

我阅读了很多关于它的 stackoveflow 帖子,你们中的一些人说我还需要广告 adsupport.framework 但我找不到它我在库列表的链接二进制文件中没有看到它。

网上的这些解决方案都不起作用,我被卡住了。

它有什么问题我没有收到关于我的 h 或 m 文件的任何错误那么为什么 mach-o 链接器错误有人可以帮助我吗?

最佳答案

您需要链接 AdMob 所需的框架。

转到您的目标设置,然后在构建阶段,然后在将二进制文件与库链接并添加以下框架(您可能需要其他框架,这些是基于我看到的错误):

MessageUI.framework
StoreKit.framework
SystemConfiguration.framework

关于ios - 使用 admob 时出现 apple mach-o 链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14484442/

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