Class is implemented in both, One of the two will be used. Which one is undefined

后端 未结 5 881
感情败类
感情败类 2020-12-04 19:15

I have an issue with dependencies included in Cocoapods.

I have a Framework project (MyFramework target), which also has App target (MyFrameworkExampleApp). When I t

5条回答
  •  温柔的废话
    2020-12-04 20:17

    I also found another a script someone wrote that fix the bug automatically. It's simply make the same I answered above. Add it to your Podfile:

    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
    

提交回复
热议问题