2014-11-05 90 views
0

對CocoaPods非常沮喪,並希望某種靈魂能夠幫助我。我安裝了兩個依賴項。一切都正確建立,直到我犯了嚴重的錯誤,實際上試圖在我的代碼中使用這些依賴關係。CocoaPods打破了我的項目

在我SubscribeViewController.m文件,我添加這一條簡單的直線(即發出任何編譯器警告或錯誤):

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; 

然後我去跑項目,以及出現這種情況:

enter image description here

我看到了一些潛在的解決方案,比如adding SubscribeViewController.m給我的編譯源和changing有效的體系結構。這些都不起作用。我該怎麼做才能讓這些依賴關係發揮作用?

這裏是Podfile:

platform :ios, '7.0' 

source 'https://github.com/CocoaPods/Specs.git' 

target 'MyProject' do 
    pod 'Braintree' 
    pod "AFNetworking", "~> 2.0" 
end 

target 'MyProjectTests' do 
    pod 'Braintree' 
    pod "AFNetworking", "~> 2.0" 
end 
+0

您是從'.xcodeproj'還是'.xcworkscpace'構建? – Adam 2014-11-05 18:08:52

+1

這就是爲什麼我永遠不會相信cocoapods。我曾嘗試過一次,因爲人們向我保證它和Python的pip一樣有用,但pip從未強迫我的整個項目以完全不同的方式組織起來。我的建議:拋出cocoapods並手動添加你的依賴到你的項目。這並不難,事實上,我認爲即使使用Cocoapods也能完美地工作,這並不是對手動添加依賴關係的改進。 – ArtOfWarfare 2014-11-05 18:10:59

+0

@Adam - xcworkspace。 – Alex 2014-11-05 18:15:40

回答

0

的AFHttp莢可能尚未建立該體系結構。我在我的podfile中有這個,所以你可以試試看看是否有幫助。儘管我不確定這是否是實際的解決方案,但我只是將它寫成格式化的答案。

# Remove 64-bit build architecture from Pods targets 
post_install do |installer| 
    installer.project.targets.each do |target| 
    target.build_configurations.each do |configuration| 
     target.build_settings(configuration.name)['ARCHS'] = '$(ARCHS_STANDARD_32_BIT)' 
    end 
    end 
end 

您能否包含您當前的podfile?

+0

當然。感謝您的建議。 – Alex 2014-11-05 18:38:38

+0

這允許我的項目構建。然而,我得到一個非常關注的編譯器警告'Pods-MyProect被拒絕作爲'libPods-MyProject.a'的隱式依賴,因爲它的架構'i386'不包含所有必需的架構'x86_64'。任何關於這可能的後果的想法?我不會留下未解決的編譯器警告。 – Alex 2014-11-05 22:59:18

+0

我相信你應該從構建目標中刪除64位體系結構。看到這裏:http://stackoverflow.com/questions/18881986/integration-error-with-cocoapods-and-xcode5 – mitrenegade 2014-11-06 15:34:05