Alamofire Xcode 8 Swift 3 da como resultado 786 errores de compilación
Estoy usando el Xcode 8.0 GM. Creé una aplicación de vista única predeterminada con mi destino de implementación establecido en 9.0.
En mi Podfile estoy apuntando a la rama bleeding edge Swift 3:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target 'MyProject' do
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3'
end
Corro pod install
y obtengo ... Installing Alamofire (4.0.0-beta.2)
... fantástico, sin problemas. Abro MyProject.xcworkspace
.
Esto aparece:
No puedo golpear más tarde porque me dice:
Xcode 8 no será capaz de construir el objetivo "Alamofire" , y ciertas características de edición no funciona correctamente hasta que el código fuente de Swift en este destino se haya convertido.
Eso no es bueno, quiero construirlo. Así que presioné "Convertir". Me da opciones:
Bueno, eso es lo que quiero, Swift 3. Se ve bien, le di a "siguiente".
El valor predeterminado es estos 3 destinos seleccionados. Ok bien, golpeo siguiente.
Lo que en el Santo nombre de Dios...
Quiero usar Alamofire swift3
bleeding edge branch en un proyecto Xcode 8, Swift 3 dirigido a iOS 9.0. ¿Dónde me equivoqué y cómo puedo hacer que esto funcione? FWIW Recibo un montón de errores al intentar usar la rama Swift 2.3 de Alamofire, así que sé que es algo que estoy haciendo mal.
10 answers
Actualizando a los últimos Cocoapods (en el momento de esta respuesta: version 1.1.0.beta.2
) mediante el comando:
gem install cocoapods --pre
parecía resolver el problema por mi circunstancia.
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-10-25 20:46:08
Pude hacerlo funcionar:
Actualización:
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
target 'PROJECT NAME HERE' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'swift3'
end
Pod actualizar Alamofire
Debería actualizarse a 4.0.0-beta.2
Hay algunos cambios al recibir una solicitud:
Antiguo:
Alamofire.request(URL_NAME_HERE, withMethod: .get).responseJSON { response in
//Code here.
}
Nuevo:
Alamofire.request(URL_NAME_HERE, method: .get).responseJSON { response in
//Code here.
}
Espero que esto ayude.
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-09-08 06:24:25
Debe usar la rama master
ahora ya que la rama swift3
se ha fusionado allí. Además, es normal que el Migrador Xcode muestre tantos errores. Lo que está haciendo es compilar el código pensando que es una versión heredada de Swift, pero como ya está en Swift 3.0, los errores son de esperar. Finalmente, Xcode le pide que convierta a la sintaxis moderna de Swift probablemente porque no ha utilizado la última versión de Cocoapods para instalar Alamofire.
NB: evento aunque Cocoapods dice para usar gem install cocoapods --pre
, yo prefiero usar gem update cocoapods --pre
. De lo contrario, la versión anterior de Cocoapods permanece y aún se usa cuando se usa pod update
. Compruebe qué versión está utilizando con pod --version
.
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-09-22 21:34:37
Actualizar el pod a 1.1.0.rc usando el siguiente comando.
sudo gem install cocoapods
Use el fragmento de golpe al final.
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
Esto ayuda.
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-09-21 18:09:14
La solución es cambiar su solicitud de este
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3'
A esto
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'master'
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-12-25 22:37:10
Resolví un problema similar usando
pod 'Alamofire', '~> 4.0'
En el archivo pod. Tuve que ajustarme a un objetivo de despliegue mínimo más alto.
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-10-20 09:02:04
Resolví un problema similar usando:
platform :ios, '9.0'
use_frameworks!
target 'PROJECT NAME HERE' do
pod 'Alamofire'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.0'
end
end
end
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
2017-04-08 10:10:32
Tuve el mismo problema, pero desinstalé cocoapods, desinstalé alamofire y luego actualizé mis cocoa pods a 1.1.0.beta.2, luego utilizó la rama swift3-rebased de Alamofire en mi archivo pod
pod 'Alamofire',
:git => 'https://github.com/Alamofire/Alamofire.git',
:branch => 'swift3-rebased'
Abrí mi Proyecto .el archivo xcworkspace y todos los errores de compilación para Alamofire se habían ido.
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-09-09 03:18:03
No estoy seguro de si esto ayuda a alguien, pero por si acaso.. Traté de agregar Alamofire a una aplicación rápida de muestra en Xcode 8.0 GM usando la aplicación independiente CocoaPods.. Seguí recibiendo la conversión a swift 2.3 o 3.0 ventana.. pero luego traté de la línea de comandos para pod update y funcionó. No tengo idea de por qué.. Asumo que los comandos subyacentes para la aplicación independiente son los mismos.. así que no estoy seguro de qué hizo la diferencia. En cualquier caso, después de 30 minutos de tiempo perdido, la mía funciona.
Esta es la captura de pantalla de la línea de comandos.. same pod file
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-09-14 08:27:05
Necesitas usar la versión 4.0 pod 'Alamofire', '~> 4.0'
observe que CocoaPods 1.1 es necesario.
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
2017-01-08 20:52:26