From 6c21bdbef76b9b548ab4939edd60b2f796f3d6f3 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 1 Jul 2026 21:38:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20iOS=20.ipa=20=E6=89=93=E5=8C=85=E6=88=90?= =?UTF-8?q?=E5=8A=9F=20-=20=E4=BF=AE=E5=A4=8D=20Team=20ID=E3=80=81Bundle.m?= =?UTF-8?q?odule=E3=80=81@main=20=E5=85=A5=E5=8F=A3=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - build-ios.sh: 设置正确 Team ID (LR8YT5M53U), 添加 GENERATE_INFOPLIST_FILE - MiniPlayerApp.swift: Bundle.module → Bundle.main (非SPM), @main 条件编译 - 签名: Apple Development + Personal Team provisioning profile - 产物: MiniPlayer.ipa (584K) --- .gitignore | 1 + Sources/MiniPlayerApp.swift | 9 ++++++++- project.yml | 34 ---------------------------------- scripts/build-ios.sh | 13 ++++++++----- 4 files changed, 17 insertions(+), 40 deletions(-) delete mode 100644 project.yml diff --git a/.gitignore b/.gitignore index f127af2..1ee8a14 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ MiniPlayer.app/ .build-ios/ *.xcodeproj/ project.yml +.swiftpm/ diff --git a/Sources/MiniPlayerApp.swift b/Sources/MiniPlayerApp.swift index c4108c1..4e8a2cb 100644 --- a/Sources/MiniPlayerApp.swift +++ b/Sources/MiniPlayerApp.swift @@ -60,6 +60,9 @@ class AppDel: NSObject, NSApplicationDelegate { } #endif +#if !SWIFT_PACKAGE +@main +#endif public struct MiniPlayerApp: App { #if os(macOS) @NSApplicationDelegateAdaptor(AppDel.self) var appDelegate @@ -189,10 +192,14 @@ public struct MiniPlayerApp: App { if let mainResources = Bundle.main.url(forResource: "i18n", withExtension: nil) { return Bundle.main } + #if SWIFT_PACKAGE return Bundle.module + #else + return Bundle.main + #endif }() #else - let bundle = Bundle.module + let bundle = Bundle.main #endif if let url = bundle.url(forResource: "i18n/\(langFile)", withExtension: "json"), let data = try? Data(contentsOf: url), diff --git a/project.yml b/project.yml deleted file mode 100644 index fbadb99..0000000 --- a/project.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: MiniPlayer -options: - bundleIdPrefix: com.miniplayer - deploymentTargets: - iOS: "17.0" - macOS: "14.0" - xcodeVersion: "15.0" - generateEmptyDirectories: true - groupSortPosition: top - -targets: - MiniPlayer: - type: application - platform: [iOS, macOS] - sources: - - path: Sources - settings: - base: - PRODUCT_BUNDLE_IDENTIFIER: com.miniplayer.app - PRODUCT_NAME: MiniPlayer - MARKETING_VERSION: "1.0.0" - CURRENT_PROJECT_VERSION: 1 - DEVELOPMENT_TEAM: "" - INFOPLIST_KEY_UILaunchScreen_Generation: YES - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad: "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight" - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone: "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight" - INFOPLIST_KEY_LSApplicationCategoryType: "public.app-category.entertainment" - INFOPLIST_KEY_CFBundleDisplayName: "MiniPlayer" - INFOPLIST_KEY_NSHumanReadableCopyright: "Copyright 2024. All rights reserved." - GENERATE_INFOPLIST_FILE: YES - SWIFT_VERSION: "5.9" - SWIFT_EMIT_LOC_STRINGS: YES - ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon" - ENABLE_HARDENED_RUNTIME: YES diff --git a/scripts/build-ios.sh b/scripts/build-ios.sh index 5283845..ca3a504 100755 --- a/scripts/build-ios.sh +++ b/scripts/build-ios.sh @@ -11,8 +11,8 @@ APP_NAME="MiniPlayer" VERSION=$(date +%Y.%m.%d) BUILD_DIR="$PROJECT_DIR/.build-ios" -# 签名配置 (修改为你的实际值) -TEAM_ID="${IOS_TEAM_ID:-YOUR_TEAM_ID}" +# 签名配置 +TEAM_ID="${IOS_TEAM_ID:-LR8YT5M53U}" BUNDLE_ID="com.miniplayer.ios" PROVISIONING_PROFILE="${IOS_PROVISIONING_PROFILE:-}" # 留空用 automatic signing EXPORT_METHOD="development" # development / ad-hoc / app-store @@ -68,6 +68,7 @@ targets: SWIFT_VERSION: "5.9" CODE_SIGN_STYLE: Automatic DEVELOPMENT_TEAM: $TEAM_ID + GENERATE_INFOPLIST_FILE: YES ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon resources: - path: Sources/Resources @@ -104,10 +105,12 @@ xcodebuild archive \ -destination "generic/platform=iOS" \ -archivePath "$ARCHIVE_PATH" \ -allowProvisioningUpdates \ - 2>&1 | tail -20 + 2>&1 | tail -30 -if [ $? -ne 0 ]; then - echo " ✗ Archive 失败" +ARCHIVE_EXIT=${PIPESTATUS[0]} + +if [ $ARCHIVE_EXIT -ne 0 ]; then + echo " ✗ Archive 失败 (exit code: $ARCHIVE_EXIT)" echo " 提示: 确保 Team ID 和签名配置正确" exit 1 fi