diff --git a/Assets/Editor/FirebaseIosPodfilePostProcessor.cs b/Assets/Editor/FirebaseIosPodfilePostProcessor.cs new file mode 100644 index 0000000..980ea66 --- /dev/null +++ b/Assets/Editor/FirebaseIosPodfilePostProcessor.cs @@ -0,0 +1,81 @@ +#if UNITY_IOS +using UnityEditor; +using UnityEditor.Callbacks; +using System.IO; +using System.Diagnostics; + +public class FirebaseIosPodfilePostProcessor +{ + [PostProcessBuild(100)] // 优先级设为 100,在其他后处理之后执行 + public static void OnPostProcessBuild(BuildTarget target, string pathToBuiltProject) + { + if (target != BuildTarget.iOS) return; + + string podfilePath = Path.Combine(pathToBuiltProject, "Podfile"); + + // 生成 Podfile + string podfileContent = @"source 'https://cdn.cocoapods.org/' + +platform :ios, '15.0' + +target 'UnityFramework' do + pod 'Firebase/Core', '12.4.0' + pod 'Firebase/Auth', '12.4.0' + pod 'Firebase/Database', '12.4.0' + pod 'Firebase/Messaging', '12.4.0' +end +target 'Unity-iPhone' do +end +use_frameworks! :linkage => :static +"; + + File.WriteAllText(podfilePath, podfileContent); + UnityEngine.Debug.Log("[FirebaseIosPostProcessor] Podfile 已生成: " + podfilePath); + + // 尝试自动运行 pod install + TryRunPodInstall(pathToBuiltProject); + } + + private static void TryRunPodInstall(string projectPath) + { + try + { + ProcessStartInfo startInfo = new ProcessStartInfo + { + FileName = "pod", + Arguments = "install", + WorkingDirectory = projectPath, + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + CreateNoWindow = true + }; + + using (Process process = Process.Start(startInfo)) + { + string stdout = process.StandardOutput.ReadToEnd(); + string stderr = process.StandardError.ReadToEnd(); + process.WaitForExit(); + + if (process.ExitCode == 0) + { + UnityEngine.Debug.Log("[FirebaseIosPostProcessor] pod install 成功"); + } + else + { + UnityEngine.Debug.LogWarning("[FirebaseIosPostProcessor] pod install 失败:\n" + stderr); + UnityEngine.Debug.LogWarning("[FirebaseIosPostProcessor] 请手动在 " + projectPath + " 目录下执行 pod install"); + } + } + } + catch (System.Exception e) + { + UnityEngine.Debug.LogWarning("[FirebaseIosPostProcessor] 未找到 CocoaPods,请手动执行:\n" + + " 1. 安装 CocoaPods: sudo gem install cocoapods\n" + + " 2. cd " + projectPath + "\n" + + " 3. pod install\n" + + " 错误: " + e.Message); + } + } +} +#endif diff --git a/Assets/Editor/FirebaseIosPodfilePostProcessor.cs.meta b/Assets/Editor/FirebaseIosPodfilePostProcessor.cs.meta new file mode 100644 index 0000000..09976c2 --- /dev/null +++ b/Assets/Editor/FirebaseIosPodfilePostProcessor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3865f2d3232564d5eac2422f14cdf6e3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/BluetoothLEOSX.bundle.meta b/Assets/Plugins/BluetoothLEOSX.bundle.meta deleted file mode 100644 index 70ea6fd..0000000 --- a/Assets/Plugins/BluetoothLEOSX.bundle.meta +++ /dev/null @@ -1,80 +0,0 @@ -fileFormatVersion: 2 -guid: 5383f7d08256547f6b36ee834b840062 -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - defineConstraints: [] - isPreloaded: 0 - isOverridable: 0 - isExplicitlyReferenced: 0 - validateReferences: 1 - platformData: - - first: - : Any - second: - enabled: 0 - settings: - Exclude Android: 1 - Exclude Editor: 0 - Exclude Linux64: 1 - Exclude OSXUniversal: 0 - Exclude Win: 1 - Exclude Win64: 1 - Exclude iOS: 1 - - first: - Android: Android - second: - enabled: 0 - settings: - CPU: ARMv7 - - first: - Any: - second: - enabled: 0 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - CPU: AnyCPU - DefaultValueInitialized: true - OS: AnyOS - - first: - Standalone: Linux64 - second: - enabled: 0 - settings: - CPU: AnyCPU - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: - CPU: AnyCPU - - first: - Standalone: Win - second: - enabled: 0 - settings: - CPU: x86 - - first: - Standalone: Win64 - second: - enabled: 0 - settings: - CPU: x86_64 - - first: - iPhone: iOS - second: - enabled: 0 - settings: - AddToEmbeddedBinaries: false - CPU: AnyCPU - CompileFlags: - FrameworkDependencies: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Plugins/BluetoothLEOSX.bundle/Contents/Info.plist b/Assets/Plugins/BluetoothLEOSX.bundle/Contents/Info.plist deleted file mode 100644 index 4ac7d39..0000000 --- a/Assets/Plugins/BluetoothLEOSX.bundle/Contents/Info.plist +++ /dev/null @@ -1,52 +0,0 @@ - - - - - BuildMachineOSBuild - 21E258 - CFBundleDevelopmentRegion - en - CFBundleExecutable - BluetoothLEOSX - CFBundleIdentifier - com.shatalmic.BluetoothLEOSX - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - BluetoothLEOSX - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 13E113 - DTPlatformName - macosx - DTPlatformVersion - 12.3 - DTSDKBuild - 21E226 - DTSDKName - macosx12.3 - DTXcode - 1330 - DTXcodeBuild - 13E113 - LSMinimumSystemVersion - 10.11 - NSBluetoothAlwaysUsageDescription - Bluetooth is required to work with devices. - NSHumanReadableCopyright - Copyright © 2016 Shatalmic. All rights reserved. - - diff --git a/Assets/Plugins/BluetoothLEOSX.bundle/Contents/MacOS/BluetoothLEOSX b/Assets/Plugins/BluetoothLEOSX.bundle/Contents/MacOS/BluetoothLEOSX deleted file mode 100644 index 331bbcd..0000000 Binary files a/Assets/Plugins/BluetoothLEOSX.bundle/Contents/MacOS/BluetoothLEOSX and /dev/null differ diff --git a/Assets/Plugins/BluetoothLEOSX.bundle/Contents/_CodeSignature/CodeResources b/Assets/Plugins/BluetoothLEOSX.bundle/Contents/_CodeSignature/CodeResources deleted file mode 100644 index d5d0fd7..0000000 --- a/Assets/Plugins/BluetoothLEOSX.bundle/Contents/_CodeSignature/CodeResources +++ /dev/null @@ -1,115 +0,0 @@ - - - - - files - - files2 - - rules - - ^Resources/ - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^Resources/Base\.lproj/ - - weight - 1010 - - ^version.plist$ - - - rules2 - - .*\.dSYM($|/) - - weight - 11 - - ^(.*/)?\.DS_Store$ - - omit - - weight - 2000 - - ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ - - nested - - weight - 10 - - ^.* - - ^Info\.plist$ - - omit - - weight - 20 - - ^PkgInfo$ - - omit - - weight - 20 - - ^Resources/ - - weight - 20 - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^Resources/Base\.lproj/ - - weight - 1010 - - ^[^/]+$ - - nested - - weight - 10 - - ^embedded\.provisionprofile$ - - weight - 20 - - ^version\.plist$ - - weight - 20 - - - - diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 6f841f9..a6a25a5 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -9,9 +9,9 @@ PlayerSettings: AndroidFilterTouchesWhenObscured: 0 AndroidEnableSustainedPerformanceMode: 0 defaultScreenOrientation: 0 - targetDevice: 2 + targetDevice: 0 useOnDemandResources: 0 - accelerometerFrequency: 60 + accelerometerFrequency: 100 companyName: photonmatrix productName: photonmatrix defaultCursor: {fileID: 0} @@ -166,12 +166,13 @@ PlayerSettings: androidMaxAspectRatio: 2.1 applicationIdentifier: Android: com.photonmatrix.photonmatrix + iPhone: com.photonmatrix.photonmatrix buildNumber: Standalone: 0 VisionOS: 0 iPhone: 0 tvOS: 0 - overrideDefaultApplicationIdentifier: 1 + overrideDefaultApplicationIdentifier: 0 AndroidBundleVersionCode: 1 AndroidMinSdkVersion: 31 AndroidTargetSdkVersion: 0 @@ -189,7 +190,7 @@ PlayerSettings: strictShaderVariantMatching: 0 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSSimulatorArchitecture: 0 + iOSSimulatorArchitecture: 1 iOSTargetOSVersionString: 15.0 tvOSSdkVersion: 0 tvOSSimulatorArchitecture: 0 @@ -509,8 +510,8 @@ PlayerSettings: enableInternalProfiler: 0 logObjCUncaughtExceptions: 1 enableCrashReportAPI: 0 - cameraUsageDescription: 用于扫描二维码 - locationUsageDescription: 用于蓝牙设备通信 + cameraUsageDescription: "\u7528\u4E8E\u626B\u63CF\u4E8C\u7EF4\u7801" + locationUsageDescription: "\u7528\u4E8E\u84DD\u7259\u8BBE\u5907\u901A\u4FE1" microphoneUsageDescription: bluetoothUsageDescription: macOSTargetOSVersion: 10.13.0