Podfile 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. require_relative '../node_modules/react-native/scripts/react_native_pods'
  2. require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
  3. platform :ios, '12.0'
  4. target 'JuicePlus' do
  5. config = use_native_modules!
  6. pod 'react-native-google-maps', :path => '../node_modules/react-native-maps'
  7. #pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  8. permissions_path = '../node_modules/react-native-permissions/ios'
  9. pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency" #访问设备的广告标识符
  10. #pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral" #访问蓝牙
  11. #pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars" #访问日历
  12. pod 'Permission-Camera', :path => "#{permissions_path}/Camera" #访问相机
  13. #pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts" #访问联系人
  14. #pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID" #访问FaceID
  15. pod 'Permission-LocationAccuracy', :path => "#{permissions_path}/LocationAccuracy" #访问高明度定位
  16. pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" #始终访问位置信息
  17. pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" #在使用中访问位置信息
  18. #pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary" #使用媒体库
  19. pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone" #使用麦克风
  20. #pod 'Permission-Motion', :path => "#{permissions_path}/Motion" #运动权限
  21. pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications" #使用通知
  22. pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary" #使用照片库
  23. pod 'Permission-PhotoLibraryAddOnly', :path => "#{permissions_path}/PhotoLibraryAddOnly" #添加照片
  24. #pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders"
  25. #pod 'Permission-Siri', :path => "#{permissions_path}/Siri"
  26. #pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"
  27. #pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit"
  28. #谷歌通知启用
  29. pod 'Firebase/Core', :modular_headers => true
  30. pod 'Firebase/Analytics', :modular_headers => true
  31. pod 'Firebase/Messaging', :modular_headers => true
  32. pod 'FirebaseCoreInternal', :modular_headers => true
  33. pod 'GoogleUtilities', :modular_headers => true
  34. #微软热更新
  35. pod 'CodePush', :path => '../node_modules/react-native-code-push'
  36. pod 'AppCenter', :modular_headers => true
  37. pod 'AppCenter/Analytics', :modular_headers => true
  38. pod 'AppCenter/Crashes', :modular_headers => true
  39. use_react_native!(
  40. :path => config[:reactNativePath],
  41. # to enable hermes on iOS, change `false` to `true` and then install pods
  42. :hermes_enabled => false
  43. )
  44. target 'JuicePlusTests' do
  45. inherit! :complete
  46. # Pods for testing
  47. end
  48. # Enables Flipper.
  49. #
  50. # Note that if you have use_frameworks! enabled, Flipper will not work and
  51. # you should disable the next line.
  52. #use_flipper!()
  53. #use_flipper!('Flipper' => '0.75.1', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1')
  54. #post_install do |installer|
  55. # react_native_post_install(installer)
  56. #end
  57. #--------------------修复iOS 16.4新建RN0.64无法运行--------------------------
  58. post_install do |installer|
  59. react_native_post_install(installer)
  60. fix_library_search_paths(installer)
  61. installer.pods_project.build_configurations.each do |config|
  62. config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
  63. ends
  64. end
  65. end
  66. def fix_library_search_paths(installer)
  67. def fix_config(config)
  68. lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
  69. if lib_search_paths
  70. 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)\"")
  71. # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
  72. # since the libraries there are only built for x86_64 and i386.
  73. lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
  74. lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
  75. if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
  76. # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
  77. lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
  78. end
  79. end
  80. end
  81. end
  82. projects = installer.aggregate_targets
  83. .map{ |t| t.user_project }
  84. .uniq{ |p| p.path }
  85. .push(installer.pods_project)
  86. projects.each do |project|
  87. project.build_configurations.each do |config|
  88. fix_config(config)
  89. end
  90. project.native_targets.each do |target|
  91. target.build_configurations.each do |config|
  92. fix_config(config)
  93. end
  94. end
  95. project.save()
  96. end
  97. # 在Xcode中选择您的项目,然后转到“Build Settings”,向下滚动,直到您看到“Search Paths”,最后看到“Library Search Paths”。
  98. # 将"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)"替换为"$(SDKROOT)/usr/lib/swift"
  99. # pre_install do |installer|
  100. # Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  101. # installer.pod_targets.each do |pod|
  102. # if $static_framework.include?(pod.name)
  103. # def pod.build_type;
  104. # Pod::BuildType.static_library
  105. # end
  106. # end
  107. # end
  108. # end
  109. # post_install do |installer|
  110. # installer.pods_project.targets.each do |target|
  111. # target.build_configurations.each do |config|
  112. # config.build_settings['ENABLE_BITCODE'] = 'NO'
  113. # config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
  114. # end
  115. # end
  116. # react_native_post_install(installer)
  117. # end
  118. #--------------------修复iOS 16.4新建RN0.64无法运行--------------------------
  119. #⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄修复iOS 14.5新建RN0.64无法运行⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄⌄
  120. # def find_and_replace(dir, findstr, replacestr)
  121. # Dir[dir].each do |name|
  122. # text = File.read(name)
  123. # replace = text.gsub(findstr,replacestr)
  124. # if text != replace
  125. # puts "Fix: " + name
  126. # File.open(name, "w") { |file| file.puts replace }
  127. # STDOUT.flush
  128. # end
  129. # end
  130. # Dir[dir + '*/'].each(&method(:find_and_replace))
  131. # end
  132. # post_install do |installer|
  133. # flipper_post_install(installer)
  134. # find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
  135. # "atomic_notify_one(state)", "folly::atomic_notify_one(state)")
  136. # find_and_replace("Pods/Flipper-Folly/folly/synchronization/DistributedMutex-inl.h",
  137. # "atomic_wait_until(&state, previous | data, deadline)", "folly::atomic_wait_until(&state, previous | data, deadline)")
  138. # installer.pods_project.targets.each do |target|
  139. # target.build_configurations.each do |config|
  140. # config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' #将所有插件更新为iOS12可用
  141. # end
  142. # end
  143. # end
  144. #⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃修复iOS 14.5新建RN0.64无法运行⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃⌃
  145. end