1

我在我的项目中添加了最新的 6.9.2 google admob,当我添加 admob 代码时,我得到了很多错误,因为我没有添加任何框架。但之后我得到 1 个错误

请检查错误

    Ld /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator/iFix.app/iFix normal x86_64
    cd /Users/apple/Documents/myApp/iFix
    export IPHONEOS_DEPLOYMENT_TARGET=7.1
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator -L/Users/apple/Documents/myApp/iFix/GoogleMobileAdsSdkiOS-6.9.2/Add-ons/GoogleAnalyticsServicesiOS_3.06 -L/Users/apple/Documents/myApp/iFix/GoogleMobileAdsSdkiOS-6.9.2 -F/Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator -filelist /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/iFix.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -lsqlite3 -framework CoreTelephony -framework AudioToolbox -lz -lGoogleAnalyticsServices -framework CoreData -framework SystemConfiguration -framework AdSupport -framework StoreKit -framework MessageUI -lAdIdAccess -lGoogleAdMobAds -framework QuartzCore -framework CoreGraphics -framework Accelerate -framework UIKit -framework Foundation -Xlinker -dependency_info -Xlinker /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/iFix_dependency_info.dat -o /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Products/Debug-iphonesimulator/iFix.app/iFix

duplicate symbol _OBJC_IVAR_$_RootViewController._delegate in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_IVAR_$_RootViewController._tableView in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_IVAR_$_RootViewController._items in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_CLASS_$_RootViewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_METACLASS_$_RootViewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-7D747D9B193AB571.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/RootViewController-484D37809EE9EA65.o
duplicate symbol _OBJC_CLASS_$_ImageViewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-4F03FFF23E5AE975.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-842B460CB8ABB481.o
duplicate symbol _OBJC_METACLASS_$_ImageViewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-4F03FFF23E5AE975.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/ImageViewController-842B460CB8ABB481.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._category in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._delegate in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._tableView in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_IVAR_$_CategoryViewController._items in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_CLASS_$_CategoryViewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _OBJC_METACLASS_$_CategoryViewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-85440B24E1A926F.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/CategoryViewController-4147041320096859.o
duplicate symbol _main in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-C7855F1C6FD2F976.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-FCACA536EA23C482.o
duplicate symbol _OBJC_METACLASS_$_NavController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-13F0601C84D2856E.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-B8881D70D2C31978.o
duplicate symbol _OBJC_CLASS_$_NavController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-13F0601C84D2856E.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/NavController-B8881D70D2C31978.o
duplicate symbol _main in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-C7855F1C6FD2F976.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/main-BA62C00639C12D74.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._navController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._viewController in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_IVAR_$_AppDelegate._images in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-2A03492D855AA76D.o
    /Users/apple/Library/Developer/Xcode/DerivedData/iFix-bbdyzggojkuirifhdwktfnpnlnnj/Build/Intermediates/iFix.build/Debug-iphonesimulator/iFix.build/Objects-normal/x86_64/AppDelegate-1751825DEB2A726D.o
ld: 23 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

请检查我的框架 在此处输入图像描述

并且用于 admob 的代码是

enter code here


- (GADRequest *)createRequest {
    GADRequest *request = [GADRequest request];

    // Make the request for a test ad. Put in an identifier for the simulator as
    // well as any devices you want to receive test ads.
    request.testDevices =
    [NSArray arrayWithObjects:
     // TODO: Add your device/simulator test identifiers here. They are
     // printed to the console when the app is launched.
     nil];
    return request;
}

#pragma mark GADBannerViewDelegate impl

// We've received an ad successfully.
- (void)adViewDidReceiveAd:(GADBannerView *)adView {
    NSLog(@"Received ad successfully");
}

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

-(void)viewDidAppear:(BOOL)animated{
    if([GMMConnectivity hasConnectivity]){
        // [self loadAds];
        NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 15.0 target: self
                                                          selector: @selector(callAfterSixtySecond:) userInfo: nil repeats: YES];
    }
}
-(void) callAfterSixtySecond:(NSTimer*) t
{

    if([GMMConnectivity hasConnectivity]){

        [self.adBanner removeFromSuperview];
        [self loadAdmob];
    }
}

-(void)loadAdmob{

    CGPoint origin;
    if(IS_RETINA){
        if([[UIScreen mainScreen] bounds].size.height >500){
            //        NSLog(@"5");
            origin = CGPointMake(0.0,
                                 568-
                                 CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
        }else{
            //        NSLog(@"4");

            origin = CGPointMake(0.0,
                                 (480)-
                                 CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);
        }
    }else{
        //        NSLog(@"3");

        origin = CGPointMake(0.0,
                             (460)-
                             CGSizeFromGADAdSize(kGADAdSizeSmartBannerPortrait).height);

    }
    // Use predefined GADAdSize constants to define the GADBannerView.
    self.adBanner = [[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait
                                                   origin:origin]
    ;

    // Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
    // before compiling.
    self.adBanner.adUnitID = MY_BANNER_UNIT_ID;
    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);
    [self.adBanner loadRequest:[self createRequest]];
    [self.view addSubview:adBanner_];


}
4

2 回答 2

0

我在添加 Google Analytics SDK 时遇到了类似的问题。您应该删除 AdMob SDK 包中的示例代码,然后重新构建。让我知道它是否能解决您的问题。

于 2014-06-12T05:30:33.130 回答
0

我添加了 -ObjC i 其他链接器标志及其现在工作

于 2014-06-13T10:13:51.563 回答