# Resolve react_native_pods.rb with node to allow for hoisting require Pod::Executable.execute_command('node', ['-p', 'require.resolve( "react-native/scripts/react_native_pods.rb", {paths: [process.argv[1]]}, )', __dir__]).strip platform :ios, min_ios_version_supported prepare_react_native_project! # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set. # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded # # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js` # ```js # module.exports = { # dependencies: { # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}), # ``` flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled linkage = ENV['USE_FRAMEWORKS'] if linkage != nil Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green use_frameworks! :linkage => linkage.to_sym end target 'Strides' do config = use_native_modules! # Flags change depending on the env values. flags = get_default_flags() pod 'react-native-google-maps', :path => '../node_modules/react-native-maps' #pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency" #访问设备的广告标识符 #pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral" #访问蓝牙 #pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars" #访问日历 pod 'Permission-Camera', :path => "#{permissions_path}/Camera" #访问相机 #pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts" #访问联系人 #pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID" #访问FaceID pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy" #访问高精度定位 pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" #始终访问位置信息 pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" #在使用中访问位置信息 #pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary" #使用媒体库 pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone" #使用麦克风 #pod 'Permission-Motion', :path => "#{permissions_path}/Motion" #运动权限 pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications" #使用通知 pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary" #使用照片库 pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly" #添加照片 #pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders" #pod 'Permission-Siri', :path => "#{permissions_path}/Siri" #pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition" #pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit" #谷歌通知启用 pod 'Firebase/Core', '9.4.0', :modular_headers => true pod 'Firebase/Analytics', '9.4.0', :modular_headers => true pod 'Firebase/Messaging', '9.4.0', :modular_headers => true pod 'FirebaseCoreInternal', '9.4.0', :modular_headers => true pod 'GoogleUtilities', :modular_headers => true #微软热更新 #pod 'CodePush', :path => '../node_modules/react-native-code-push' #国际化 #pod 'RNI18n', :path => '../node_modules/react-native-i18n' use_react_native!( :path => config[:reactNativePath], # Hermes is now enabled by default. Disable by setting this flag to false. :hermes_enabled => flags[:hermes_enabled], :fabric_enabled => flags[:fabric_enabled], # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. :flipper_configuration => flipper_config, # An absolute path to your application root. :app_path => "#{Pod::Config.instance.installation_root}/.." ) target 'StridesTests' do inherit! :complete # Pods for testing end # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable the next line. #use_flipper!() #use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1') #post_install do |installer| # react_native_post_install(installer) #end #--------------------修复iOS 16.4新建RN0.64无法运行-------------------------- # post_install do |installer| # react_native_post_install(installer) # fix_library_search_paths(installer) # installer.pods_project.build_configurations.each do |config| # config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" # end #end post_install do |installer| react_native_post_install( installer, config[:reactNativePath], :mac_catalyst_enabled => false ) __apply_Xcode_12_5_M1_post_install_workaround(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