diff --git a/ios/Podfile b/ios/Podfile index ce17794db..41d32f019 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -40,6 +40,45 @@ target 'Runner' do end post_install do |installer| + # ---- Auto patch: bump FlutterGeneratedPluginSwiftPackage iOS platform ---- + # Flutter 生成的中介包总是写死 .iOS("12.0"),与 Podfile 中的 + # platform :ios, '16.0' 不一致,会报 + # "requires minimum platform version 15.0/16.0 ... but this target supports 12.0"。 + # 这里自动同步为 16.0。 + generated_pkg = File.expand_path( + 'Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage/Package.swift', __dir__) + if File.exist?(generated_pkg) + content = File.read(generated_pkg) + new_content = content.gsub(/\.iOS\("\d+\.\d+"\)/, '.iOS("16.0")') + if new_content != content + File.write(generated_pkg, new_content) + puts '[Podfile patch] Bumped FlutterGeneratedPluginSwiftPackage iOS platform to 16.0' + end + end + + # ---- Auto patch: comment out illegal `` imports in all Pods sources ---- + # 新版 Xcode 模块校验禁止跨模块引用私有头 `` + # `` 已包含全部 IPv6 定义,注释掉即可。 + pods_dir = File.expand_path('Pods', __dir__) + if Dir.exist?(pods_dir) + patched_files = [] + Dir.glob(File.join(pods_dir, '**', '*.{m,mm,h,hpp,c,cpp}')).each do |file| + content = File.read(file) + new_content = content.gsub( + /^[ \t]*#\s*(?:import|include)\s*.*$/, + '// \0 // patched: private header, covered by ' + ) + if new_content != content + File.write(file, new_content) + patched_files << file.sub(pods_dir + '/', '') + end + end + unless patched_files.empty? + puts "[Podfile patch] Commented out imports in #{patched_files.size} file(s):" + patched_files.each { |f| puts " - #{f}" } + end + end + installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index fcad18058..ed13eec0f 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -251,7 +251,7 @@ ); mainGroup = 97C146E51CF9000F007C117D; packageReferences = ( - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; @@ -506,7 +506,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 537SFY28XS; + DEVELOPMENT_TEAM = K39FB49XKY; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 16.6; @@ -781,7 +781,7 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = { isa = XCLocalSwiftPackageReference; relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; }; diff --git a/local_plugins/chat_api/ios/chat_api/Package.swift b/local_plugins/chat_api/ios/chat_api/Package.swift index 3fe0ccdb5..2e6a43d64 100644 --- a/local_plugins/chat_api/ios/chat_api/Package.swift +++ b/local_plugins/chat_api/ios/chat_api/Package.swift @@ -14,7 +14,9 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/MacPaw/OpenAI.git", exact: "0.4.3"), - .package(url: "https://github.com/modelcontextprotocol/swift-sdk.git", from: "0.9.0"), + // 改用本地副本:上游 swift-sdk 0.9.0 的 Package.swift 声明 swift-tools-version:6.0 + // 会在 Xcode 16 上把 sending 警告升级为错误。本地副本将其降为 5.10 规避。 + .package(path: "../../../swift_sdk_local"), .package(path: "../../../location_service/ios/location_service"), .package(path: "../../../music_service/ios/music_service"), .package(path: "../../../qq_music/ios/qq_music"), @@ -25,7 +27,7 @@ let package = Package( .target( name: "chat_api", dependencies: [ - .product(name: "MCP", package: "swift-sdk"), + .product(name: "MCP", package: "swift_sdk_local"), .product(name: "OpenAI", package: "OpenAI"), .product(name: "music-service", package: "music_service"), .product(name: "qq-music", package: "qq_music"),