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