1

由于现在earlgrey 2的pod版本已经过时了,所以我尝试使用直接复制的方法,并在构建AppFramework上卡住了。所以我在这里遵循了设置指南:Github 上的 Earlgrey 2

git clone -b earlgrey2 https://github.com/google/EarlGrey.git
cd EarlGrey
sh Scripts/download_deps.sh

然后我在 XCode 中打开 EarlGrey.xcodeproj 文件并开始构建所有目标,除了 ApppFramework 之外的所有目标都没有任何问题地构建。但是当我尝试构建 AppFramework 目标时,首先我收到了关于在 GreyAppStateTracker.m 中使用 self 的错误(第 361 行),我通过更改_printAppStateTrackerLogself->_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 以防万一。

4

1 回答 1

1

我遇到过同样的问题。看看这两个文件

CommonLib/Config/GREYAppState.m </p>

CommonLib/GREYLogger.m

它们目前不是项目的一部分,但它们应该是。添加它们,并确保目标成员资格都设置为 AppFramework。之后,AppFramework 在我的系统上正确构建。

于 2020-09-24T10:53:35.207 回答