我最近换了一台新的MacBook Pro;我已经安装了Cocoapods和Ruby 3.0来让我的Xcode工作空间运行。
当以前运行相同的代码库时,在x86 MBP上的Xcode 13上进行相同的提交,全部由Build Schemes [Prod ==>释放;QA = =比;
在我的M1 MBP上,Prod方案(在发布配置上)构建并运行。然而,当我切换到QA方案(在调试配置上)时,构建立即失败。
在我的桥接头文件中,从以下行获得错误'UIScrollView_InfiniteScroll/UIScrollView+InfiniteScroll.h' file not found
:
#import <UIScrollView_InfiniteScroll/UIScrollView+InfiniteScroll.h>
还会抛出以下错误:
<unknown>:0: error: failed to emit precompiled header '/Users/admin/Library/Developer/Xcode/DerivedData/myapp-dypuhuippmcjrlhhmqiqgbjwgyof/Build/Intermediates.noindex/PrecompiledHeaders/My-Bridging-Header-swift_3V1NLTT25PR6H-clang_1XGU9G22VPOI.pch' for bridging header '/Users/admin/myapp/myapp/myapp/Supporting Files/My-Bridging-Header.h'
/Users/admin/myapp/myapp/myapp/Supporting Files/My-Bridging-Header.h:5:9: note: in file included from /Users/admin/myapp/myapp/myapp/Supporting Files/My-Bridging-Header.h:5:
我已经确认在我的构建设置中没有重大的配置变化。我已经尝试启用Validate Workspace = NO
。
模式之间最重要的区别是配置(Release vs. Debug)。
当我检查/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-dypuhuippmcjrlhhmqiqgbjwgyof/Build/Intermediates.noindex/Pods.build
时,Release-iphonesimulator
有一个文件夹,但Debug
没有。这让我相信这背后有一个Cocoapods问题,而且,尽管为Pods Xcode项目设置了所有配置,但Debug Pods没有被构建。
附件是我当前的pod env
:
### Stack
CocoaPods : 1.11.2
Ruby : ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
RubyGems : 3.2.22
Host : macOS 11.6 (20G165)
Xcode : 13.0 (13A233)
Git : git version 2.30.1 (Apple Git-130)
Ruby lib dir : /Users/admin/homebrew/Cellar/ruby/3.0.2_1/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
### Installation Source
Executable Path: /Users/admin/homebrew/lib/ruby/gems/3.0.0/bin/pod
### Plugins
cocoapods-deintegrate : 1.0.5
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.1
cocoapods-trunk : 1.6.0
cocoapods-try : 1.2.0
### Podfile
platform :ios, '11.0'
target 'Geojam' do
use_frameworks! :linkage => :static
pod 'Alamofire', '~> 4.8.2'
pod 'Kingfisher', '~> 6.3.0'
pod 'IQKeyboardManagerSwift', '~> 6.3.0'
pod 'PromiseKit', '~> 6.8.0'
pod 'SwipeMenuViewController'
pod 'UIScrollView-InfiniteScroll', '~> 1.1.0'
pod 'PhoneNumberKit', '~> 3.1'
pod 'Blueprints'
pod 'Toaster', :git => 'https://github.com/DominatorVbN/Toaster.git', :branch => 'master'
pod "Atributika"
pod 'Instabug'
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '7.3.0'
# DB
# Reactive
pod 'ReactiveSwift', '~> 6.1'
# Firebase
pod 'Firebase', '7.7.0'
pod 'FirebaseAuth', '7.7.0'
pod 'FirebaseMessaging', '7.7.0'
pod 'FirebaseFirestore', '7.7.0'
pod 'FirebaseStorage', '7.7.0'
pod 'GooglePlaces', '4.2.0'
# Add the pod for Firebase Crashlytics
pod 'Firebase/Crashlytics'
# Recommended: Add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
#API Debug
pod 'netfox'
end
post_install do |pi|
pi.pods_project.targets.each do |t|
t.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings["ONLY_ACTIVE_ARCH"] = "YES"
end
end
end
问题是pod install
执行时Pods.xcodeproj
文件中没有设置排除的体系结构。
我通过添加以下安装后脚本来修复它:
post_install do |pi|
pi.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
这为项目级别的每个配置添加了一个排除,这是需要的。
我真希望Cocoapods能自动设置,但同时你得自己设置!
通过Rosetta运行Xcode。在Finder中找到Xcode,右键单击,获取信息,然后左边应该会弹出一个窗口。勾选"使用Rosetta打开">