Files
suixinkan_ios_new/Podfile
汉秋 8997d1ba1c 集成 MJRefresh 并重构主 TabBar 为系统 TabView 样式。
新增 SwiftUI 桥接层与单元测试,更新 Tab 图标资源命名和多倍图,同步调整 UI Test 的 Tab/扫码定位逻辑。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 10:22:53 +08:00

91 lines
3.3 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

platform :ios, '16.0'
target 'suixinkan' do
use_frameworks!
# 高德地图 SDK仅真机构建时链接模拟器通过 post_install 剥离(见下方说明)
pod 'AMap3DMap-NO-IDFA', '~> 11.1'
pod 'AMapSearch-NO-IDFA', '~> 9.7'
pod 'AMapLocation-NO-IDFA', '~> 2.11'
pod 'MJRefresh', '~> 3.7'
target 'suixinkanTests' do
inherit! :search_paths
end
end
# 模拟器可用的链接参数(不含高德 prebuilt framework
SIMULATOR_OTHER_LDFLAGS = <<~FLAGS.squish
-ObjC -l"c++" -l"z"
-framework "CoreGraphics" -framework "CoreLocation" -framework "CoreTelephony"
-framework "CoreText" -framework "ExternalAccessory" -framework "GLKit"
-framework "OpenGLES" -framework "QuartzCore" -framework "Security"
-framework "SystemConfiguration"
FLAGS
post_install do |installer|
# 1. 修正 aggregate xcconfig去掉 arm64 排除,模拟器单独链接(不链 AMap
%w[Pods-suixinkan Pods-suixinkanTests].each do |target_name|
support_dir = File.join(installer.sandbox.root, 'Target Support Files', target_name)
Dir.glob(File.join(support_dir, '*.xcconfig')).each do |path|
content = File.read(path)
content.gsub!("EXCLUDED_ARCHS[sdk=iphonesimulator*] = arm64\n", '')
unless content.include?('OTHER_LDFLAGS[sdk=iphonesimulator*]')
content << "\nOTHER_LDFLAGS[sdk=iphonesimulator*] = #{SIMULATOR_OTHER_LDFLAGS}\n"
content << "FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*] = $(inherited)\n"
end
File.write(path, content)
end
end
# 2. AMap pod target 标记为仅真机
installer.pods_project.targets.each do |target|
next unless target.name.start_with?('AMap')
target.build_configurations.each do |config|
config.build_settings['SUPPORTED_PLATFORMS'] = 'iphoneos'
end
end
# 3. 模拟器跳过 AMap.bundle 资源拷贝(当前 Pods 资源仅此一项)
resources_script = File.join(
installer.sandbox.root,
'Target Support Files/Pods-suixinkan/Pods-suixinkan-resources.sh'
)
if File.exist?(resources_script)
content = File.read(resources_script)
unless content.include?('SKIP_AMAP_RESOURCES_FOR_SIMULATOR')
content.sub!(
"RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt",
<<~SHELL
# SKIP_AMAP_RESOURCES_FOR_SIMULATOR
if [ "${EFFECTIVE_PLATFORM_NAME}" = "-iphonesimulator" ]; then
exit 0
fi
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
SHELL
)
File.write(resources_script, content)
end
end
# 4. 主工程:允许 arm64 模拟器、真机编译期注入 AMAP_ENABLED、关闭脚本沙盒CocoaPods 兼容)
installer.aggregate_targets.each do |aggregate_target|
aggregate_target.user_project.native_targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = ''
config.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
next unless target.name == 'suixinkan'
existing = config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS[sdk=iphoneos*]'] || '$(inherited)'
config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS[sdk=iphoneos*]'] = "#{existing} AMAP_ENABLED" unless existing.to_s.include?('AMAP_ENABLED')
end
end
aggregate_target.user_project.save
end
end