From 754e2da5232ac33f55e01577c70e6eb33ecfa721 Mon Sep 17 00:00:00 2001 From: RN Date: Fri, 16 May 2025 11:23:12 +0800 Subject: [PATCH] ios --- ios/Frameworks/UnityFramework.framework | 1 + ios/Podfile | 31 ++-- ios/Runner.xcodeproj/project.pbxproj | 144 ++++++++++++++++-- .../UnityFramework/module.modulemap | 5 + ios/UnityLibrary/UnityLibrary.podspec | 18 +-- 5 files changed, 159 insertions(+), 40 deletions(-) create mode 120000 ios/Frameworks/UnityFramework.framework create mode 100644 ios/UnityLibrary/UnityFramework/module.modulemap diff --git a/ios/Frameworks/UnityFramework.framework b/ios/Frameworks/UnityFramework.framework new file mode 120000 index 0000000..ed7c9fe --- /dev/null +++ b/ios/Frameworks/UnityFramework.framework @@ -0,0 +1 @@ +UnityLibrary/UnityFramework \ No newline at end of file diff --git a/ios/Podfile b/ios/Podfile index 704a4fb..c332fb1 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -41,20 +41,23 @@ platform :ios, '12.0' end post_install do |installer| - installer.pods_project.targets.each do |target| - flutter_additional_ios_build_settings(target) + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) - # 为所有目标添加必要的iOS设置 - target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' + # 为所有目标添加必要的iOS设置 + target.build_configurations.each do |config| + config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' - # 禁用位码 - config.build_settings['ENABLE_BITCODE'] = 'NO' + # 禁用位码 + config.build_settings['ENABLE_BITCODE'] = 'NO' - # 为UnityLibrary添加特殊设置 - if target.name == 'UnityLibrary' - config.build_settings['DEFINES_MODULE'] = 'YES' - end - end - end - end \ No newline at end of file + # 为flutter_unity_widget添加特殊设置 + if target.name == 'flutter_unity_widget' + config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)'] + config.build_settings['FRAMEWORK_SEARCH_PATHS'] << '${PODS_ROOT}/../UnityLibrary' + config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)'] + config.build_settings['HEADER_SEARCH_PATHS'] << '${PODS_ROOT}/../UnityLibrary/UnityFramework' + end + end + end +end \ No newline at end of file diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index dacc6f3..15f79e7 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ @@ -61,6 +61,48 @@ remoteGlobalIDString = 9D25AB9D213FB47800354C27; remoteInfo = UnityFramework; }; + 10484A322DD6E45F00D28557 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1048471F2DD5F83C00D28557 /* Unity-iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1D6058910D05DD3D006BFB54; + remoteInfo = "Unity-iPhone"; + }; + 10484A342DD6E45F00D28557 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1048471F2DD5F83C00D28557 /* Unity-iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5623C57317FDCB0800090B9E; + remoteInfo = "Unity-iPhone Tests"; + }; + 10484A362DD6E45F00D28557 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 1048471F2DD5F83C00D28557 /* Unity-iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 9D25AB9D213FB47800354C27; + remoteInfo = UnityFramework; + }; + 104851D82DD6E54C00D28557 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 10484EC62DD6E54A00D28557 /* Unity-iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 1D6058910D05DD3D006BFB54; + remoteInfo = "Unity-iPhone"; + }; + 104851DA2DD6E54C00D28557 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 10484EC62DD6E54A00D28557 /* Unity-iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 5623C57317FDCB0800090B9E; + remoteInfo = "Unity-iPhone Tests"; + }; + 104851DC2DD6E54C00D28557 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 10484EC62DD6E54A00D28557 /* Unity-iPhone.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 9D25AB9D213FB47800354C27; + remoteInfo = UnityFramework; + }; 10D463692DD5965F004AD299 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 10D461DC2DD5965F004AD299 /* Unity-iPhone.xcodeproj */; @@ -149,6 +191,8 @@ /* Begin PBXFileReference section */ 104802882DD5E90C00D28557 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; 104837DD2DD5F00200D28557 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; + 1048471F2DD5F83C00D28557 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; + 10484EC62DD6E54A00D28557 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; 10D461DC2DD5965F004AD299 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; 10D480402DD5D629004AD299 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; 10D4865C2DD5D8F8004AD299 /* Unity-iPhone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "Unity-iPhone.xcodeproj"; sourceTree = ""; }; @@ -178,7 +222,7 @@ /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 104805992DD5E90C00D28557 /* Exceptions for "UnityLibrary" folder in "RunnerTests" target */ = { + 104805992DD5E90C00D28557 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { isa = PBXFileSystemSynchronizedBuildFileExceptionSet; platformFiltersByRelativePath = { "Frameworks/com.easyar.sense/Runtime/BindingNR/Apple/iOS/ios-arm64/easyar.framework" = ( @@ -187,7 +231,7 @@ }; target = 331C8080294A63A400263BE5 /* RunnerTests */; }; - 10483AF72DD5F59800D28557 /* Exceptions for "UnityLibrary" folder in "Runner" target */ = { + 10483AF72DD5F59800D28557 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { isa = PBXFileSystemSynchronizedBuildFileExceptionSet; membershipExceptions = ( UnityFramework/Info.plist, @@ -197,19 +241,7 @@ /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ - 1048FDFF2DD5E7A300D28557 /* UnityLibrary */ = { - isa = PBXFileSystemSynchronizedRootGroup; - exceptions = ( - 10483AF72DD5F59800D28557 /* Exceptions for "UnityLibrary" folder in "Runner" target */, - 104805992DD5E90C00D28557 /* Exceptions for "UnityLibrary" folder in "RunnerTests" target */, - ); - explicitFileTypes = { - }; - explicitFolders = ( - ); - path = UnityLibrary; - sourceTree = ""; - }; + 1048FDFF2DD5E7A300D28557 /* UnityLibrary */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (10483AF72DD5F59800D28557 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, 104805992DD5E90C00D28557 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = UnityLibrary; sourceTree = ""; }; /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ @@ -252,6 +284,26 @@ name = Products; sourceTree = ""; }; + 104847222DD5F83C00D28557 /* Products */ = { + isa = PBXGroup; + children = ( + 10484A332DD6E45F00D28557 /* Unity-Target-New.app */, + 10484A352DD6E45F00D28557 /* Unity-iPhone Tests.xctest */, + 10484A372DD6E45F00D28557 /* UnityFramework.framework */, + ); + name = Products; + sourceTree = ""; + }; + 10484EC92DD6E54A00D28557 /* Products */ = { + isa = PBXGroup; + children = ( + 104851D92DD6E54C00D28557 /* Unity-Target-New.app */, + 104851DB2DD6E54C00D28557 /* Unity-iPhone Tests.xctest */, + 104851DD2DD6E54C00D28557 /* UnityFramework.framework */, + ); + name = Products; + sourceTree = ""; + }; 10D461DF2DD5965F004AD299 /* Products */ = { isa = PBXGroup; children = ( @@ -443,10 +495,18 @@ productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; projectReferences = ( + { + ProductGroup = 10484EC92DD6E54A00D28557 /* Products */; + ProjectRef = 10484EC62DD6E54A00D28557 /* Unity-iPhone.xcodeproj */; + }, { ProductGroup = 10D4865E2DD5D8F8004AD299 /* Products */; ProjectRef = 10D4865C2DD5D8F8004AD299 /* Unity-iPhone.xcodeproj */; }, + { + ProductGroup = 104847222DD5F83C00D28557 /* Products */; + ProjectRef = 1048471F2DD5F83C00D28557 /* Unity-iPhone.xcodeproj */; + }, { ProductGroup = 10D461DF2DD5965F004AD299 /* Products */; ProjectRef = 10D461DC2DD5965F004AD299 /* Unity-iPhone.xcodeproj */; @@ -517,6 +577,50 @@ remoteRef = 10483AF52DD5F06300D28557 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 10484A332DD6E45F00D28557 /* Unity-Target-New.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + name = "Unity-Target-New.app"; + path = arTourismFlutterUnity.app; + remoteRef = 10484A322DD6E45F00D28557 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 10484A352DD6E45F00D28557 /* Unity-iPhone Tests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "Unity-iPhone Tests.xctest"; + remoteRef = 10484A342DD6E45F00D28557 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 10484A372DD6E45F00D28557 /* UnityFramework.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = UnityFramework.framework; + remoteRef = 10484A362DD6E45F00D28557 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 104851D92DD6E54C00D28557 /* Unity-Target-New.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + name = "Unity-Target-New.app"; + path = arTourismFlutterUnity.app; + remoteRef = 104851D82DD6E54C00D28557 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 104851DB2DD6E54C00D28557 /* Unity-iPhone Tests.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "Unity-iPhone Tests.xctest"; + remoteRef = 104851DA2DD6E54C00D28557 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 104851DD2DD6E54C00D28557 /* UnityFramework.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = UnityFramework.framework; + remoteRef = 104851DC2DD6E54C00D28557 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 10D4636A2DD5965F004AD299 /* Unity-Target-New.app */ = { isa = PBXReferenceProxy; fileType = wrapper.application; @@ -615,10 +719,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Copy Pods Resources"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n"; @@ -648,10 +756,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; diff --git a/ios/UnityLibrary/UnityFramework/module.modulemap b/ios/UnityLibrary/UnityFramework/module.modulemap new file mode 100644 index 0000000..5abcdae --- /dev/null +++ b/ios/UnityLibrary/UnityFramework/module.modulemap @@ -0,0 +1,5 @@ +framework module UnityFramework { + umbrella header "UnityFramework.h" + export * + module * { export * } +} diff --git a/ios/UnityLibrary/UnityLibrary.podspec b/ios/UnityLibrary/UnityLibrary.podspec index 9794e40..110d9a8 100644 --- a/ios/UnityLibrary/UnityLibrary.podspec +++ b/ios/UnityLibrary/UnityLibrary.podspec @@ -24,14 +24,12 @@ Pod::Spec.new do |s| "Libraries/**/*.a" ] s.module_name = "UnityLibrary" - s.xcconfig = { +s.xcconfig = { "DEFINES_MODULE" => "YES", - "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_ROOT}/UnityLibrary/Frameworks\" \"${PODS_ROOT}/UnityLibrary/Frameworks/com.easyar.sense/Runtime/BindingNR/Apple/iOS/ios-arm64\"", - "LIBRARY_SEARCH_PATHS" => "\"${PODS_ROOT}/UnityLibrary/Libraries\"", - "OTHER_LDFLAGS" => "\"$(inherited) -framework UnityFramework\"", - "ENABLE_BITCODE" => "NO", - "CLANG_ENABLE_MODULES" => "YES", - "SWIFT_INCLUDE_PATHS" => "\"${PODS_ROOT}/UnityLibrary/Frameworks/UnityFramework.framework/Headers\"" - } - -end + "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_ROOT}/UnityLibrary\" \"${PODS_ROOT}/UnityLibrary/Frameworks/com.easyar.sense/Runtime/BindingNR/Apple/iOS/ios-arm64\"", + "HEADER_SEARCH_PATHS" => "\"${PODS_ROOT}/UnityLibrary/UnityFramework\" \"${PODS_ROOT}/UnityLibrary/Libraries/libil2cpp/include\"", + "OTHER_LDFLAGS" => "\"$(inherited)\"", + "ENABLE_BITCODE" => "NO", + "CLANG_ENABLE_MODULES" => "YES" +} +end