[英]React Native: Problem with dependencies and archiving my project
我已經回到了一個我有一段時間沒有工作的項目。 我添加了刪除帳戶功能,並計划在當天將其發布到蘋果商店。
我跑了npm install --legacy-peer-deps && cd ios && pod install
。 這一切都很好(我的包有點過時了,因為我有一段時間沒有在這個項目中工作了,所以我不得不使用 legacy-peer-deps 代替)。
下一步,我去了 XCode 並嘗試像往常一樣存檔我的項目,但構建失敗,錯誤為Undefined symbol: _swift_stdlib_isStackAllocationSafe
- 經過一些研究
我在這篇文章中找到了一個解決方案: Symbol(s) not found for architecture arm64 - XCode
有一個非常有用的批准答案。 我將建議的代碼添加到我的 podfile 中,並嘗試按照建議運行npm install react-native-purchases@latest
。 但是,我收到以下錯誤:
在這一點上,我在想嗯沖突依賴讓我嘗試使用npm install react-native-firebase/app
,然后這向我顯示下一個錯誤。
我嘗試安裝 babel-plugin-root-import,然后它再次向我顯示第一個圖像錯誤並重復。 我有點卡住了,我只想讓這個項目重新啟動並運行,但它很痛苦!
這是我的 package.json 供參考:
{
"scripts": {
"start": "react-native start",
"android": "npx react-native run-android",
"ios": "npx react-native run-ios --simulator='iPhone 13'",
"start:development": "NODE_ENV=development npx react-native start",
"start:production": "NODE_ENV=production npx react-native start"
},
"dependencies": {
"@fawazahmed/react-native-read-more": "^2.2.2",
"@invertase/react-native-apple-authentication": "^2.1.0",
"@react-native-community/async-storage": "^1.12.1",
"@react-native-community/blur": "^3.6.0",
"@react-native-community/google-signin": "^5.0.0",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/slider": "^3.0.3",
"@react-native-firebase/app": "^13.0.1",
"@react-native-firebase/auth": "^14.2.1",
"@react-native-firebase/firestore": "^10.5.1",
"@react-native-firebase/storage": "^13.0.1",
"@react-navigation/bottom-tabs": "^5.11.7",
"@react-navigation/native": "^5.9.2",
"@react-navigation/stack": "^5.14.2",
"expo": "~40.0.0",
"expo-app-loading": "^1.0.1",
"expo-apple-authentication": "~2.2.2",
"expo-google-app-auth": "^8.1.4",
"expo-google-sign-in": "~8.4.0",
"expo-linear-gradient": "~8.4.0",
"expo-notifications": "~0.8.2",
"expo-splash-screen": "~0.8.0",
"expo-status-bar": "~1.0.3",
"expo-updates": "~0.4.0",
"firebase": "^8.2.5",
"lottie-react-native": "^4.0.2",
"react": "16.13.1",
"react-apple-signin-auth": "^0.0.7",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-calendars": "^1.1254.0",
"react-native-countdown-circle-timer": "^2.5.0",
"react-native-device-info": "^8.0.7",
"react-native-dotenv": "^3.3.1",
"react-native-fast-image": "^8.5.11",
"react-native-gesture-handler": "^1.9.0",
"react-native-google-signin": "^2.1.1",
"react-native-haptic-feedback": "^1.11.0",
"react-native-input-scroll-view": "^1.11.0",
"react-native-keep-awake": "^4.0.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-parallax-header": "^1.1.4",
"react-native-purchases": "^4.1.1",
"react-native-reanimated": "^1.13.2",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.17.1",
"react-native-sound": "^0.11.1",
"react-native-svg": "12.1.0",
"react-native-unimodules": "~0.12.0",
"react-native-web": "~0.13.12",
"react-navigation": "^4.4.3",
"use-sound": "^2.0.1"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"babel-plugin-root-import": "^6.6.0",
"eslint-import-resolver-babel-plugin-root-import": "^1.1.1",
"jest": "~25.2.6",
"metro-react-native-babel-preset": "^0.66.2",
"prettier": "2.6.2",
"react-test-renderer": "~16.13.1"
},
"private": true,
"name": "Flexeee-RN",
"version": "1.0.0"
}
播客文件:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$FirebaseSDKVersion = '8.9.0'
platform :ios, '11.0'
target 'FlexeeeRN' do
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# Uncomment the code below to enable Flipper.
#
# You should not install Flipper in CI environments when creating release
# builds, this will lead to significantly slower build times.
#
# Note that if you have use_frameworks! enabled, Flipper will not work.
#
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
end
post_install do |installer|
react_native_post_install(installer)
fix_library_search_paths(installer)
end
end
def fix_library_search_paths(installer)
def fix_config(config)
lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
if lib_search_paths
if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
# $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
# since the libraries there are only built for x86_64 and i386.
lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
# however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
end
end
end
end
projects = installer.aggregate_targets
.map{ |t| t.user_project }
.uniq{ |p| p.path }
.push(installer.pods_project)
projects.each do |project|
project.build_configurations.each do |config|
fix_config(config)
end
project.native_targets.each do |target|
target.build_configurations.each do |config|
fix_config(config)
end
end
project.save()
end
end
任何幫助表示贊賞。 謝謝你的時間。
更新:我按照下面的建議做了npm install react-native-purchases@latest --legacy-peer-deps
(似乎有效)。 但是現在,當我運行 pod install 時,它不喜歡我添加到 Podfile 中的代碼並說:
[!] Podfile
文件無效:語法錯誤,意外結束,預期輸入結束。
# from /Users/jacksaunders/Flexeee-V2/ios/Podfile:40
# -------------------------------------------
# end
> end
#
# -------------------------------------------
我已經仔細檢查了我添加的代碼,它完全相同。 不確定,從這里做什么。
試試這個 podfile
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
$FirebaseSDKVersion = '8.9.0'
platform :ios, '11.0'
target 'FlexeeeRN' do
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# Uncomment the code below to enable Flipper.
#
# You should not install Flipper in CI environments when creating release
# builds, this will lead to significantly slower build times.
#
# Note that if you have use_frameworks! enabled, Flipper will not work.
#
# use_flipper!
# post_install do |installer|
# flipper_post_install(installer)
# end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
end
end
react_native_post_install(installer)
fix_library_search_paths(installer)
end
end
def fix_library_search_paths(installer)
def fix_config(config)
lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
if lib_search_paths
if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
# $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
# since the libraries there are only built for x86_64 and i386.
lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
# however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
end
end
end
end
projects = installer.aggregate_targets
.map{ |t| t.user_project }
.uniq{ |p| p.path }
.push(installer.pods_project)
projects.each do |project|
project.build_configurations.each do |config|
fix_config(config)
end
project.native_targets.each do |target|
target.build_configurations.each do |config|
fix_config(config)
end
end
project.save()
end
end
我認為 podfile 中應該只有一個 post_install 塊,所以我合並了兩個塊。 如果這不能立即起作用,請檢查您的do
是否與end
匹配。 您的原始文件中有一個額外的結尾。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.