我正在尝试将AdMob应用到我的iOS应用中。我按照他们提供的文档here。所以我尝试构建并运行,我得到以下错误:
Undefined symbols for architecture i386:
"_NSOverwriteMergePolicy", referenced from:
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
"_NSSQLiteErrorDomain", referenced from:
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.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)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGDataProvider.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
"_OBJC_CLASS_$_SKStoreProductViewController", 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)
编辑1:我添加了Storekit和MessageUI框架,并添加了Obj-C
链接器标志,现在我得到了这个:
Undefined symbols for architecture i386:
"_NSOverwriteMergePolicy", referenced from:
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore contextWithModel:URL:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_NSSQLiteErrorDomain", referenced from:
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_NSSQLiteStoreType", referenced from:
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
anon in libGoogleAnalyticsServices.a(TAGModel.o)
anon in libGoogleAnalyticsServices.a(GAIDataStore.o)
-[GAIDataStore coordinatorWithModel:URL:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSAttributeDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSEntityDescription", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGDataProvider.o)
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSFetchRequest", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_GAIHit in libGoogleAnalyticsServices.a(GAIHit.o)
_OBJC_CLASS_$_TAGHit in libGoogleAnalyticsServices.a(TAGHit.o)
_OBJC_CLASS_$_GAIProperty in libGoogleAnalyticsServices.a(GAIProperty.o)
_OBJC_CLASS_$_GAIProperty in libGoogleAnalytics_debug.a(GAIProperty.o)
_OBJC_CLASS_$_GAIHit in libGoogleAnalytics_debug.a(GAIHit.o)
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAICoreDataUtil.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAICoreDataUtil.o)
"_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
objc-class-ref in libGoogleAnalyticsServices.a(TAGModel.o)
objc-class-ref in libGoogleAnalyticsServices.a(GAIDataStore.o)
objc-class-ref in libGoogleAnalytics_debug.a(GAIDataStore.o)
"_OBJC_METACLASS_$_NSManagedObject", referenced from:
_OBJC_METACLASS_$_GAIHit in libGoogleAnalyticsServices.a(GAIHit.o)
_OBJC_METACLASS_$_TAGHit in libGoogleAnalyticsServices.a(TAGHit.o)
_OBJC_METACLASS_$_GAIProperty in libGoogleAnalyticsServices.a(GAIProperty.o)
_OBJC_METACLASS_$_GAIProperty in libGoogleAnalytics_debug.a(GAIProperty.o)
_OBJC_METACLASS_$_GAIHit in libGoogleAnalytics_debug.a(GAIHit.o)
"_llvm_gcda_emit_arcs", referenced from:
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIError.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIHitUtil.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIURLConnection.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackedViewController.o)
...
"_llvm_gcda_emit_function", referenced from:
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIError.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIHitUtil.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIURLConnection.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackedViewController.o)
...
"_llvm_gcda_end_file", referenced from:
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIError.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIProperty.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIHitUtil.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIURLConnection.o)
...
"_llvm_gcda_increment_indirect_counter", referenced from:
-[GAITrackerImpl gai_set:value:] in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
-[GAITrackerImpl gai_get:] in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
-[GAITrackerImpl gai_send:] in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
-[GAIDataStore performBlockAndWait:withError:] in libGoogleAnalytics_debug.a(GAIDataStore.o)
_GAIReachabilityStatusString in libGoogleAnalytics_debug.a(GAIReachabilityChecker.o)
-[GAI defaultTracker] in libGoogleAnalytics_debug.a(GAI.o)
-[GAI setDefaultTracker:] in libGoogleAnalytics_debug.a(GAI.o)
...
"_llvm_gcda_start_file", referenced from:
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDefaultLogger.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAITrackerImpl.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIDataStore.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIError.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIProperty.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIHitUtil.o)
___llvm_gcov_writeout in libGoogleAnalytics_debug.a(GAIURLConnection.o)
...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:6)
SDK库引用了六个可能的iOS开发框架 尚未成为您项目的一部分:
- StoreKit
- AudioToolbox
- MessageUI
- SystemConfiguration
- CoreGraphics中
- AdSupport
- EventKit
- EventKitUI
您可以通过项目视图添加这些框架,如图所示,并在参考文档中进行了解释。您还必须使用-ObjC链接标志。
修改强>
确保以与添加iOS框架相同的方式将Google库添加到项目中。查看this question and answer。
答案 1 :(得分:1)
你完成了第三步:
您现在需要将-ObjC添加到应用程序目标的构建设置的其他链接器标志中:
在Xcode的项目导航器中,按蓝色顶级项目图标。 单击目标,然后单击“构建设置”选项卡。 在Other Linker Flags下,将-ObjC添加到Debug和Release。
https://developers.google.com/mobile-ads-sdk/docs/admob/mediation