2013-12-09 5 views
5

Il mio team ha recentemente iniziato a utilizzare CocoaPods per gestire la dipendenza nel nostro progetto di app per iOS.Piattaforme supportate, SDK di base, impostazioni di architettura attiva solo ripristinate dopo l'aggiornamento del pod

Ecco il podfile:

platform :ios, '6.0' 

pod "UI7Kit" 
pod "AFNetworking", "~> 2.0" 
pod "TMCache" 
pod "SVProgressHUD" 
pod "SVPullToRefresh" 

Tuttavia, dopo aver utilizzato CocoaPods, gli obiettivi di costruzione per iPhone 5 non riesce sempre, ma riesce per simulatore.

Ecco il log degli errori:

ld: warning: ignoring file [DerivedData directory]/libPods.a, file was built for archive which is not the architecture being linked (armv7): [DerivedData directory]/libPods.a 
Undefined symbols for architecture armv7: 
    "_OBJC_CLASS_$_SVProgressHUD", referenced from: 
     objc-class-ref in ....o 
    "_OBJC_CLASS_$_TMCache", referenced from: 
     objc-class-ref in ....o 
    "_OBJC_CLASS_$_UI7Kit", referenced from: 
     objc-class-ref in ....o 
ld: symbol(s) not found for architecture armv7 
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

Ho provato le soluzioni di cui CocoaPods Troubleshooting, inclusa l'aggiunta la libreria statica Pods in cima alla lista, ma non riesce ancora.

Successivamente abbiamo rilevato che in "Impostazioni progetto pod"> "Impostazioni build"> "Architetture", "SDK di base" è impostato come "Nessun SDK (OS X recente)", "Crea solo architettura attiva"> "Debug" "impostato come" Sì "e" Piattaforme supportate "impostato come" OS X ". Dopo averli modificati rispettivamente su "iOS più recente (iOS 7.0)", "No", "iOS", entrambi per iPhone 5 e simulatore funzionano bene.

Tuttavia, ogni volta che facciamo Pod update, tutte e tre le impostazioni sono ripristinate ai loro stati precedenti, che è fastidioso.

Le mie domande sono:

  1. È questo il caso, per progettazione o qualcosa non va con il mio progetto ambiente/spazio di lavoro?
  2. Come impedire che queste impostazioni vengano ripristinate in stati errati?

Qualsiasi aiuto sarà apprezzato.

risposta

0

I pod Le impostazioni del progetto non sono importanti, ciò che è importante sono le impostazioni di destinazione per la libica statica del pod. Ma non dovresti toccarli.

Puoi pubblicare le impostazioni di costruzione da il tuo progetto/target? La guida alla risoluzione dei problemi suggerisce some build settings in case of failed build, aiutano? Assicurati di abilitare la visualizzazione di tutte le impostazioni di generazione e controlla se alcune impostazioni hanno la precedenza su quelle specificate nel file xcconfig generato da CocoaPods.

Verificare inoltre che il progetto si basi sul file xcconfig nella scheda Informazioni del progetto. enter image description here

Spero che qualcosa di questo aiuti.

+0

Stranamente, le impostazioni di Progetto Pod sembrano essere importanti, anche se le impostazioni di destinazione sono corrette. Solo dopo aver aggiornato manualmente le impostazioni del progetto Pod in modo tale che abbiano un set SDK di base sembra che lo risolva nella maggior parte dei casi. Non sono stato in grado di scoprire perché le impostazioni PROJECT dei pod tornano a non avere SDK di base ogni volta che viene eseguito un "aggiornamento pod". –

3

Come accennato in CocoaPods issues, è possibile aggiungere questo al vostro Podfile:

post_install do |installer_representation| 
    installer_representation.project.targets.each do |target| 
     target.build_configurations.each do |config| 
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' 
     end 
    end 
end 

questo renderà tutti i baccelli costruire per tutti arch.

1

Mi sono trovato a correre anche in questa situazione, utilizzando Cocoapods 0.36.3 e Xcode 6.2. Dubito fortemente che questa sia la soluzione migliore, ma ho scritto un hook per andare nella parte inferiore del mio Podfile che ripristina le impostazioni "BaseSDK", "Piattaforma" e "Costruisci solo architettura attiva" nel progetto Pod.Ho anche impostato "Costruisci solo architettura attiva" su "NO" per ciascuno dei bersagli, per una buona misura (come menzionato nel post precedente).

post_install do |installer_representation| 
    projectSDK = nil 

    puts"Updating all of the POD targets to not default to ONLY_ACTIVE_ARCH for debug" 
    installer_representation.project.targets.each do |target| 
     target.build_configurations.each do |config| 
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' 
      if projectSDK.nil? 
       projectSDK = config.build_settings['SDKROOT'] 
      end 
     end 
    end 
    puts "Updating ONLY_ACTIVE_ARCH for the project, as well. While the project settings aren't supposed to matter, I've not found that to be the case." 
    puts "Also setting the base SDK of the project to match that of the targets (doesn't matter which one); otherwise it defaults to No SDK (Latest OS X)" 
    installer_representation.project.build_configurations.each do |config| 
     config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' 
     config.build_settings['SDKROOT'] = projectSDK 
    end 
end 
0

per chiunque utilizzi gli ultimi Baccelli di cacao

post_install do |installer_representation| 
installer_representation.pods_project.targets.each do |target| 
    target.build_configurations.each do |config| 
     config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' 
    end 
end 

fine

1

ho usato per seguire tale procedura ... ora con cocoapods e più ore la questione ho optato per:

# fixes required for xcode project 
post_install do |installer_representation| 

puts "" 
puts "Updating VALID_ARCHS, SUPPORTED_PLATFORMS, SDKROOT for the project..." 

installer_representation.pods_project.build_configurations.each do |config| 

# config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' 

    config.build_settings['VALID_ARCHS'] = 'arm64 armv7 armv7s' 

    config.build_settings['SUPPORTED_PLATFORMS'] = 'iphonesimulator iphoneos' 

# setting the base SDK of the project to match that of the project, 
# otherwise it defaults to No SDK (Latest OS X)" 
    config.build_settings['SDKROOT'] = 'iphoneos' 

# it sets 'Valid Architectures' to '$(ARCHS_STANDARD)' to all pods 
#  config.build_settings['SDKROOT'] = projectSDK 
end 



puts "" 
puts "Updating all of the watch POD targets with specific..." 

installer_representation.pods_project.targets.each do |target| 
    target.build_configurations.each do |config| 

     if (config.build_settings['SDKROOT'] == 'watchos') 
      puts "fixing SUPPORTED_PLATFORMS & VALID_ARCHS for #{target.name} #{config.name}" 
      config.build_settings['SUPPORTED_PLATFORMS'] = 'watchsimulator watchos' 
      config.build_settings['VALID_ARCHS'] = 'arm64 armv7 armv7s armv7k i386' 
     end 

# to not default to ONLY_ACTIVE_ARCH for debug" 
#   config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' 
#   config.build_settings['ENABLE_STRICT_OBJC_MSGSEND'] = "NO" 
    end 
end 

puts "" 

end 
Problemi correlati