Podfile 6.5 KB

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