Podfile 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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 'FirebaseAuth'
  68. pod 'FirebaseCore'
  69. pod 'FirebaseAnalytics'
  70. pod 'FirebaseMessaging'
  71. # pod 'FirebaseFirestore'
  72. use_react_native!(
  73. :path => config[:reactNativePath],
  74. # Hermes is now enabled by default. Disable by setting this flag to false.
  75. :hermes_enabled => flags[:hermes_enabled],
  76. :fabric_enabled => flags[:fabric_enabled],
  77. # Enables Flipper.
  78. #
  79. # Note that if you have use_frameworks! enabled, Flipper will not work and
  80. # you should disable the next line.
  81. :flipper_configuration => flipper_config,
  82. # An absolute path to your application root.
  83. :app_path => "#{Pod::Config.instance.installation_root}/.."
  84. )
  85. target 'StridesTests' do
  86. inherit! :complete
  87. # Pods for testing
  88. end
  89. # Enables Flipper.
  90. #
  91. # Note that if you have use_frameworks! enabled, Flipper will not work and
  92. # you should disable the next line.
  93. # use_flipper!()
  94. # use_flipper!({'Flipper' => '0.182.0', 'Flipper-Folly' => '2.6.10', 'Flipper-RSocket' => '1.3.1'})
  95. #post_install do |installer|
  96. # react_native_post_install(installer)
  97. #end
  98. #--------------------修复iOS 16.4新建RN0.64无法运行--------------------------
  99. # post_install do |installer|
  100. # react_native_post_install(installer)
  101. # fix_library_search_paths(installer)
  102. # installer.pods_project.build_configurations.each do |config|
  103. # config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  104. # end
  105. #end
  106. post_install do |installer|
  107. react_native_post_install(
  108. installer,
  109. config[:reactNativePath],
  110. :mac_catalyst_enabled => false
  111. )
  112. fix_library_search_paths(installer)
  113. installer.pods_project.build_configurations.each do |config|
  114. config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  115. config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "16.4"
  116. end
  117. __apply_Xcode_12_5_M1_post_install_workaround(installer)
  118. end
  119. end
  120. def fix_library_search_paths(installer)
  121. #def fix_config(config)
  122. lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
  123. if lib_search_paths
  124. 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)\"")
  125. # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
  126. # since the libraries there are only built for x86_64 and i386.
  127. lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
  128. lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
  129. if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
  130. # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
  131. lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
  132. end
  133. end
  134. end
  135. end
  136. # projects = installer.aggregate_targets
  137. # .map{ |t| t.user_project }
  138. # .uniq{ |p| p.path }
  139. # .push(installer.pods_project)
  140. # projects.each do |project|
  141. # project.build_configurations.each do |config|
  142. # fix_config(config)
  143. # end
  144. # project.native_targets.each do |target|
  145. # target.build_configurations.each do |config|
  146. # fix_config(config)
  147. # end
  148. # end
  149. # project.save()
  150. # end
  151. # end