由于EearGrey2的pod版本目前已经相当过时,我尝试使用直接复制的方法,并在构建AppFramework时有点卡住了。所以我遵循了这里的设置指南:Earlgrey 2 on Github
git clone -b earlgrey2 https://github.com/google/EarlGrey.git
cd EarlGrey
sh Scripts/download_deps.sh然后我在XCode中打开EarlGrey.xcodeproj文件,开始构建所有的目标,除了ApppFramework之外的所有目标都构建得没有任何问题。但是当我尝试构建AppFramework目标时,首先我得到了一个关于在GreyAppStateTracker.m (第361行)中使用self的错误,我通过将_printAppStateTrackerLog更改为self->_printAppStateTrackerLog修复了这个错误。但在第二次构建尝试时,我得到了以下错误(如果我为arm或x86_64构建,这无关紧要,下面是我为arm64构建时的错误),我无法修复:
Ld /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos/AppFramework.framework/AppFramework normal (in target 'AppFramework' from project 'EarlGrey')
cd /Users/trxx/EarlGrey
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios10.0 -dynamiclib -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -L/Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos -F/Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos -filelist /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Intermediates.noindex/EarlGrey.build/Debug-iphoneos/AppFramework.build/Objects-normal/arm64/AppFramework.LinkFileList -install_name @rpath/AppFramework.framework/AppFramework -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Intermediates.noindex/EarlGrey.build/Debug-iphoneos/AppFramework.build/Objects-normal/arm64/AppFramework_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -framework IOKit -ObjC -lUILib -framework IOKit -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Intermediates.noindex/EarlGrey.build/Debug-iphoneos/AppFramework.build/Objects-normal/arm64/AppFramework_dependency_info.dat -o /Users/trxx/Library/Developer/Xcode/DerivedData/EarlGrey-evuhovbauodoondbihsejbmertdb/Build/Products/Debug-iphoneos/AppFramework.framework/AppFramework
Undefined symbols for architecture arm64:
"_GREYKeyForAppState", referenced from:
___133-[GREYAppStateTracker grey_changeState:usingOperation:forObject:orInternalObjectDeallocationTracker:orExternalAppStateTrackerObject:]_block_invoke in GREYAppStateTracker.o
"_GREYLogVerbose", referenced from:
-[GREYUIThreadExecutor drainForTime:] in GREYUIThreadExecutor.o
-[GREYUIThreadExecutor drainUntilIdle] in GREYUIThreadExecutor.o
-[GREYUIThreadExecutor drainUntilIdleWithTimeout:] in GREYUIThreadExecutor.o
-[UIViewController(GREYApp) greyswizzled_viewWillAppear:] in UIViewController+GREYApp.o
-[UIViewController(GREYApp) greyswizzled_viewWillDisappear:] in UIViewController+GREYApp.o
_ToggleShiftKeyWithError in GREYKeyboard.o
-[GREYSlideAction grey_perform:error:] in GREYSlideAction.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation) 我不太确定为什么它看不到这些符号。任何帮助都将不胜感激。我使用的是XCode 12.0以防万一。
发布于 2020-09-24 18:53:35
我也有同样的问题。看一下这两个文件
公用库/配置/GREYAppState.m
CommonLib/GREYLogger.m
它们目前不是项目的一部分,但它们应该是项目的一部分。添加它们,并确保目标成员身份为for both设置为AppFramework。在那之后,AppFramework在我的系统上正确构建。
https://stackoverflow.com/questions/64009194
复制相似问题