Orbital2024-Siyi-Xinxiang / Nuspirit

MonoRepo for mobile app
1 stars 0 forks source link

unity solve integration cocoapods issues #31

Open Blankeeir opened 5 days ago

Blankeeir commented 5 days ago

DEBUGGING: Ways to solve package duplication:

Embed in another c library TODO https://medium.com/swift-and-ios-writing/using-a-c-library-inside-a-swift-framework-d041d7b701d9 https://stackoverflow.com/questions/3276474/symbol-hiding-in-static-libraries-built-with-xcode https://stackoverflow.com/questions/26398213/link-against-two-versions-of-the-same-library-same-symbols

Change library type (dynamic/static/executable) Use cocoapods static libraries for every framework TODO (bug) Configure apps separately and hide file visibility Install firebase sdk through SPM (bug) Backup plan: use messaging instead of two libraries Handle all database at unity side

Cocoapods duplicate linker resolve:(bug) https://stackoverflow.com/questions/46932341/class-is-implemented-in-both-one-of-the-two-will-be-used-which-one-is-undefine

post_install do |installer| sharedLibrary = installer.aggregate_targets.find { |aggregate_target| aggregate_target.name == 'Pods-[MY_FRAMEWORK_TARGET]' } installer.aggregate_targets.each do |aggregate_target| if aggregate_target.name == 'Pods-[MY_APP_TARGET]' aggregate_target.xcconfigs.each do |config_name, config_file| sharedLibraryPodTargets = sharedLibrary.pod_targets aggregate_target.pod_targets.select { |pod_target| sharedLibraryPodTargets.include?(pod_target) }.each do |pod_target| pod_target.specs.each do |spec| frameworkPaths = unless spec.attributes_hash['ios'].nil? then spec.attributes_hash['ios']['vendored_frameworks'] else spec.attributes_hash['vendored_frameworks'] end || Set.new frameworkNames = Array(frameworkPaths).map(&:to_s).map do |filename| extension = File.extname filename File.basename filename, extension end end frameworkNames.each do |name| if name != '[DUPLICATED_FRAMEWORK_1]' && name != '[DUPLICATED_FRAMEWORK_2]' raise("Script is trying to remove unwanted flags: #{name}. Check it out!") end puts "Removing #{name} from OTHER_LDFLAGS" config_file.frameworks.delete(name) end end end xcconfig_path = aggregate_target.xcconfig_path(config_name) config_file.save_as(xcconfig_path) end end end