Podfile 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. # Resolve react_native_pods.rb with node to allow for hoisting
  2. require Pod::Executable.execute_command('node', ['-p',
  3. 'require.resolve(
  4. "react-native/scripts/react_native_pods.rb",
  5. {paths: [process.argv[1]]},
  6. )', __dir__]).strip
  7. require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
  8. def node_require(script)
  9. # Resolve script with node to allow for hoisting
  10. require Pod::Executable.execute_command('node', ['-p',
  11. "require.resolve(
  12. '#{script}',
  13. {paths: [process.argv[1]]},
  14. )", __dir__]).strip
  15. end
  16. node_require('react-native/scripts/react_native_pods.rb')
  17. node_require('react-native-permissions/scripts/setup.rb')
  18. platform :ios, '13.0'
  19. prepare_react_native_project!
  20. # If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
  21. # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
  22. #
  23. # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
  24. # ```js
  25. # module.exports = {
  26. # dependencies: {
  27. # ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
  28. # ```
  29. flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
  30. linkage = ENV['USE_FRAMEWORKS']
  31. if linkage != nil
  32. Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  33. use_frameworks! :linkage => linkage.to_sym
  34. end
  35. #权限处理
  36. setup_permissions([
  37. 'AppTrackingTransparency', #访问设备的广告标识符
  38. # 'BluetoothPeripheral', #访问蓝牙
  39. # 'Calendars', #访问日历
  40. 'Camera', #访问相机
  41. # 'Contacts', #访问联系人
  42. # 'FaceID', #访问FaceID
  43. 'LocationAccuracy', #访问高精度定位
  44. # 'LocationAlways', #始终访问位置信息
  45. 'LocationWhenInUse', #在使用中访问位置信息
  46. # 'MediaLibrary', #使用媒体库
  47. # 'Microphone', #使用麦克风
  48. # 'Motion', #运动权限
  49. 'Notifications', #使用通知
  50. 'PhotoLibrary', #使用照片库
  51. 'PhotoLibraryAddOnly', #添加照片
  52. # 'Reminders',
  53. # 'SpeechRecognition',
  54. # 'StoreKit'
  55. ])
  56. target 'Strides' do
  57. config = use_native_modules!
  58. # Flags change depending on the env values.
  59. flags = get_default_flags()
  60. # 谷歌地图服务
  61. pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/Simon-TechForm/google-maps-ios-utils.git', :branch => 'feat/support-apple-silicon'
  62. rn_maps_path = '../node_modules/react-native-maps'
  63. pod 'react-native-google-maps', :path => rn_maps_path
  64. # pod 'GoogleMaps', '3.5.0'
  65. # pod 'Google-Maps-iOS-Utils', '2.1.0'
  66. #谷歌通知启用
  67. pod 'Firebase/Core', '9.4.0', :modular_headers => true
  68. pod 'Firebase/Analytics', '9.4.0', :modular_headers => true
  69. pod 'Firebase/Messaging', '9.4.0', :modular_headers => true
  70. pod 'FirebaseCoreInternal', '9.4.0', :modular_headers => true
  71. pod 'GoogleUtilities', :modular_headers => true
  72. #微软热更新
  73. #pod 'CodePush', :path => '../node_modules/react-native-code-push'
  74. #国际化
  75. #pod 'RNI18n', :path => '../node_modules/react-native-i18n'
  76. use_react_native!(
  77. :path => config[:reactNativePath],
  78. # Hermes is now enabled by default. Disable by setting this flag to false.
  79. :hermes_enabled => flags[:hermes_enabled],
  80. :fabric_enabled => flags[:fabric_enabled],
  81. # Enables Flipper.
  82. #
  83. # Note that if you have use_frameworks! enabled, Flipper will not work and
  84. # you should disable the next line.
  85. :flipper_configuration => flipper_config,
  86. # An absolute path to your application root.
  87. :app_path => "#{Pod::Config.instance.installation_root}/.."
  88. )
  89. target 'StridesTests' do
  90. inherit! :complete
  91. # Pods for testing
  92. end
  93. # Enables Flipper.
  94. #
  95. # Note that if you have use_frameworks! enabled, Flipper will not work and
  96. # you should disable the next line.
  97. # use_flipper!()
  98. # use_flipper!({'Flipper' => '0.182.0', 'Flipper-Folly' => '2.6.10', 'Flipper-RSocket' => '1.3.1'})
  99. #post_install do |installer|
  100. # react_native_post_install(installer)
  101. #end
  102. #--------------------修复iOS 16.4新建RN0.64无法运行--------------------------
  103. # post_install do |installer|
  104. # react_native_post_install(installer)
  105. # fix_library_search_paths(installer)
  106. # installer.pods_project.build_configurations.each do |config|
  107. # config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  108. # end
  109. #end
  110. post_install do |installer|
  111. react_native_post_install(
  112. installer,
  113. config[:reactNativePath],
  114. :mac_catalyst_enabled => false
  115. )
  116. fix_library_search_paths(installer)
  117. installer.pods_project.build_configurations.each do |config|
  118. config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  119. config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "16.4"
  120. end
  121. __apply_Xcode_12_5_M1_post_install_workaround(installer)
  122. end
  123. end
  124. def fix_library_search_paths(installer)
  125. def fix_config(config)
  126. lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
  127. if lib_search_paths
  128. 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)\"")
  129. # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
  130. # since the libraries there are only built for x86_64 and i386.
  131. lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
  132. lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
  133. if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
  134. # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
  135. lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
  136. end
  137. end
  138. end
  139. end
  140. projects = installer.aggregate_targets
  141. .map{ |t| t.user_project }
  142. .uniq{ |p| p.path }
  143. .push(installer.pods_project)
  144. projects.each do |project|
  145. project.build_configurations.each do |config|
  146. fix_config(config)
  147. end
  148. project.native_targets.each do |target|
  149. target.build_configurations.each do |config|
  150. fix_config(config)
  151. end
  152. end
  153. project.save()
  154. end
  155. end