我最近更新了一臺新的 MacBook Pro 13" M1 并設定了 Cocoapods 和 Ruby 3.0 來運行我的 Xcode Workspace。
以前在 x86 MBP 上運行相同的代碼庫時,在 Xcode 13 上進行相同的提交,所有這些都由 Build Schemes [Prod ==> Release; 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.
模式之間的主要顯著差異是配置(發布與除錯)。
當我檢查/Users/admin/Library/Developer/Xcode/DerivedData/MyApp-dypuhuippmcjrlhhmqiqgbjwgyof/Build/Intermediates.noindex/Pods.build有一個檔案夾時,Release-iphonesimulator但沒有用于Debug. 這讓我相信這背后存在 Cocoapods 問題,并且盡管為 Pods Xcode 專案設定了所有配置,但并未構建 Debug pod。
附上我現在的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
uj5u.com熱心網友回復:
問題是Pods.xcodeproj在pod install執行時檔案中缺少設定的排除架構。
我通過添加以下安裝后腳本來修復它:
post_install do |pi|
pi.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
這為專案級別的每個配置添加了一個排除項,這是必需的。
我確實希望 Cocoapods 可以使這個自動化,但同時你必須自己設定它!
uj5u.com熱心網友回復:
通過 Rosetta 運行您的 Xcode。在 Finder 中找到 Xcode,右鍵單擊,獲取資訊,然后應該會在左側彈出一個視窗。選中“使用 Rosetta 打開”框
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/339848.html
