美文网首页
Cocoapods 编译条件数组处理

Cocoapods 编译条件数组处理

作者: 幸运者_Lucky | 来源:发表于2021-08-26 18:03 被阅读0次

    为什么非要定义一个变量,直接使用config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] += ,说是个String,
    直接拼接到 string 上了,很奇怪!

    post_install do |installer|
      installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
    
          conditions = ['$(inherited)']
    
          if config.name.include?("Test")
            conditions += ['TEST']
          end
          
          if config.name.include?("Debug") && config.name != 'Debug'
            conditions += ['DEBUG']
          end
    
          if target == 'WidgetExtension'
            conditions += ['WIDGET']
          end
          
          config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = conditions
          
        end
      end
    end
    
    

    相关文章

      网友评论

          本文标题:Cocoapods 编译条件数组处理

          本文链接:https://www.haomeiwen.com/subject/hpmuiltx.html