Deshabilitar bitcode para dependencias de proyectos y cocoapods con Xcode7?


¿Cómo puedes desactivar bitcode para tus dependencias de proyecto y cocoapod? Aquí está el error que obtengo al intentar ejecutar mi proyecto con Xcode 7.

No contiene bitcode. Debe reconstruirlo con bitcode habilitado (Xcode setting ENABLE_BITCODE), obtener una biblioteca actualizada del proveedor o deshabilitar bitcode para este objetivo. para arquitectura arm64

Editar: Originalmente solo se deshabilitó para uno de los destinos. Una vez que desactivé todos ellos y fui capaz de construir exitoso.

Author: Anders, 2015-09-18

5 answers

Para establecer esta configuración de una manera que no se anule cada vez que haga un pod install puede agregar esto a su Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'
    end
  end
end
 132
Author: Keith Smiley,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-20 23:40:51

Hay una manera de construir objetivos de CocoaPods con bitcode completo. Simplemente agregue la opción -fembed-bitcode a OTHER_CFLAGS de cada:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']
      cflags << '-fembed-bitcode'
      config.build_settings['OTHER_CFLAGS'] = cflags
    end
  end
end

Creo que de esta manera es mejor que deshabilitar bitcode.

 6
Author: werediver,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-23 09:34:38

Vaya a la configuración de compilación para el destino en el que desea deshabilitarlo. Busque algo que diga "Habilitar Bitcode", configúrelo a No.

 1
Author: Kris Gellci,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-09-17 21:25:22
project 'frameworkTest.xcodeproj'

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'

target 'frameworkTest' do
  # Uncomment this line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for frameworkTest
  source 'https://github.com/CocoaPods/Specs.git' 


#zip files libs
  pod 'SSZipArchive'

#reachability 
  pod 'Reachability'

end

#bitcode enable
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|

      # set valid architecture
      config.build_settings['VALID_ARCHS'] = 'arm64 armv7 armv7s i386 x86_64'

      # build active architecture only (Debug build all)
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'

      config.build_settings['ENABLE_BITCODE'] = 'YES'

      if config.name == 'Release' || config.name == 'Pro'
          config.build_settings['BITCODE_GENERATION_MODE'] = 'bitcode'
      else # Debug
          config.build_settings['BITCODE_GENERATION_MODE'] = 'marker'
      end

      cflags = config.build_settings['OTHER_CFLAGS'] || ['$(inherited)']

      if config.name == 'Release' || config.name == 'Pro'
          cflags << '-fembed-bitcode'
      else # Debug
          cflags << '-fembed-bitcode-marker'
      end      

      config.build_settings['OTHER_CFLAGS'] = cflags
    end
  end
end
 1
Author: Romulo Rego,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-07-06 10:57:34

Deshabilitar Bitcode en el Proyecto Principal y Pods

Las otras respuestas no logran borrar la bandera de bitcode para el proyecto principal. Los hooks Post-Install del Cocoapod no te dan acceso al proyecto principal, creo que esta es una elección de diseño, por lo que necesitas encontrar el archivo del proyecto y modificarlo usando xcodeproj. Si una biblioteca binaria incluye bitcode, necesitará usar xcrun bitcode_strip para eliminar el bitcode para hacer que el proyecto sea consistente.

Dos ayudantes funciones

def disable_bitcode_for_target(target)
    target.build_configurations.each do |config|
      config.build_settings['ENABLE_BITCODE'] = 'NO'

      remove_cflags_matching(config.build_settings, ['-fembed-bitcode', '-fembed-bitcode-marker'])
    end
end

def remove_cflags_matching(build_settings, cflags)
  existing_cflags = build_settings['OTHER_CFLAGS']

  removed_cflags = []
  if !existing_cflags.nil?
    cflags.each do |cflag|
      existing_cflags.delete_if { |existing_cflag| existing_cflag == cflag && removed_cflags << cflag }
    end
  end

  if removed_cflags.length > 0
    build_settings['OTHER_CFLAGS'] = existing_cflags
  end
end

Fase post-instalación

post_install do |installer|    
  project_name = Dir.glob("*.xcodeproj").first
  project = Xcodeproj::Project.open(project_name)
  project.targets.each do |target|
    disable_bitcode_for_target(target)
  end
  project.save

  installer.pods_project.targets.each do |target|
    disable_bitcode_for_target(target)
  end

  installer.pods_project.save
end
 0
Author: Cameron Lowell Palmer,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-10-04 11:52:16