fix: iOS .ipa 打包成功 - 修复 Team ID、Bundle.module、@main 入口点

- 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)
This commit is contained in:
yumoqing 2026-07-01 21:38:52 +08:00
parent d22a5037b8
commit 6c21bdbef7
4 changed files with 17 additions and 40 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ MiniPlayer.app/
.build-ios/
*.xcodeproj/
project.yml
.swiftpm/

View File

@ -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),

View File

@ -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

View File

@ -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