2017-03-09 58 views
2

我目前正在嘗試首次創建包含多個依賴關係的窗格。是帶有靜態庫依賴關係的CocoaPod

目前,我包括我的莢莢如下

  • FacebookCore
  • FacebookLogin
  • 面料
  • TwitterKit
  • 谷歌/登入
  • LinkedinSwift

podspec文件看起來像這樣

Pod::Spec.new do |s| 

    s.platform  = :ios 
    s.ios.deployment_target = '8.0' 
    s.name   = "Socializin" 
    s.version  = "0.0.1" 
    s.summary  = "A short description of Socializin." 
    s.requires_arc = true 

    s.author  = {"MyName" => "MyMail"} 
    s.homepage  = "http://EXAMPLE/Socializin" 
    s.license  = { :type => "MIT", :file => "LICENSE" } 
    s.source  = { :git => "", :tag => "#{s.version}"} 

    s.framework = "UIKit" 
    s.dependency 'FacebookCore', '~> 0.2.0' 
    s.dependency 'FacebookLogin', '~> 0.2.0' 
    s.dependency 'FacebookShare', '~> 0.2.0' 
    s.dependency 'Fabric', '~> 1.6.11' 
    s.dependency 'TwitterKit', '~> 2.8.1' 
    s.dependency 'Google/SignIn', '~> 3.0.3' 
    s.dependency 'LinkedinSwift', '~> 1.7.4' 

    s.source_files = "Socializin/**/*.{swift}" 
    #s.resources = "Socializin/**/*.{png,jpeg,jpg,storyboard,xib}" 
end 

但依賴給我下面的錯誤

[!] The 'Pods-socializinTest' target has transitive dependencies that include static binaries: (/Users/x/projects/x/Examples/socializinTest/Pods/Fabric/iOS/Fabric.framework, /Users/x/projects/x/Examples/socializinTest/Pods/Google/Frameworks/GGLCore.framework, and /Users/x/projects/x/Examples/socializinTest/Pods/Google/Frameworks/GGLSignIn.framework)

反正是有,以確保它的工作?我想要做的就是創建一個可以輕鬆使用所有這些服務並能夠在需要時添加更多服務的窗格。

回答

0

我希望你仍然在尋找解決方案。
這是我做過什麼:
我把谷歌登入框架下/依存/ GoogleDependency
,我把該TwitterKit,TwitterCore和Fabric架構下/依存/ TwitterDependency/

Pod::Spec.new do |s| 
    s.platform  = :ios 
    s.ios.deployment_target = '9.0' 
    s.name   = "Socializin" 
    s.version  = "0.0.1" 
    s.summary  = "A short description of Socializin." 
    s.requires_arc = true 

    s.author  = {"MyName" => "MyMail"} 
    s.homepage  = "http://EXAMPLE/Socializin" 
    s.license  = { :type => "MIT", :file => "LICENSE" } 
    s.source  = { :git => "", :tag => "#{s.version}"} 

    s.framework = "UIKit" 
    s.dependency 'FacebookCore', '~> 0.2.0' 
    s.dependency 'FacebookLogin', '~> 0.2.0' 
    s.dependency 'FacebookShare', '~> 0.2.0' 
    s.dependency 'LinkedinSwift', '~> 1.7.4' 

    s.source_files = "Socializin/**/*.{swift}" 
    #s.resources = "Socializin/**/*.{png,jpeg,jpg,storyboard,xib}" 

    #----------------------------Sub Modules-----------------# 
    s.subspec 'GoogleAuthentication' do |ss| 
    ss.ios.deployment_target = '9.0' 
    ss.source_files = 'Socializin/Dependency/GoogleDependency/**/*.{swift}' 
    ss.resources = ['Socializin/Dependency/GoogleDependency/**/*.{xib,xcdatamodeld,bundle}'] 
    ss.vendored_frameworks = ['Socializin/Dependency/GoogleDependency/**/*.{framework}'] 
    ss.preserve_paths = ['Socializin/Dependency/GoogleDependency/**/*.{framework}'] 
    frameworkPaths = '' 
    Dir.glob('Socializin/Dependency/GoogleDependency/**/*.{framework}') do |filename| 
     filePath = Pathname.new(filename) 
     newFilename = filePath.dirname 
     if frameworkPaths != "" 
     frameworkPaths = "#{frameworkPaths} \"$(PODS_ROOT)/#{newFilename}\"" 
     else 
     frameworkPaths = "\"$(PODS_ROOT)/#{newFilename}\"" 
     end 
    end 
    ss.xcconfig = { 
     'FRAMEWORK_SEARCH_PATHS' => frameworkPaths, 
     'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Socializin/Dependency/GoogleDependency"', 
    } 
    #Authentication 
    # ss.dependency 'GoogleSignIn' 
    ss.dependency 'GoogleToolboxForMac/NSDictionary+URLArguments' 
    ss.dependency 'GoogleToolboxForMac/NSData+zlib' 
    end 

    s.subspec 'TwitterAuthentication' do |ss| 
    ss.ios.deployment_target = '9.0' 
    ss.source_files = 'Socializin/Dependency/TwitterDependency/**/*.{swift}' 
    ss.resources = ['Socializin/Dependency/TwitterDependency/TwitterKit/iOS/TwitterKit.framework/*.{xib,xcdatamodeld,bundle}'] 
    ss.vendored_frameworks = ['Socializin/Dependency/TwitterDependency/**/*.{framework}'] 
    ss.preserve_paths = ['Socializin/Dependency/TwitterDependency/**/*.{framework}'] 
    frameworkPaths = '' 
    Dir.glob('Socializin/Dependency/TwitterDependency/**/*.{framework}') do |filename| 
     filePath = Pathname.new(filename) 
     newFilename = filePath.dirname 
     if frameworkPaths != "" 
     frameworkPaths = "#{frameworkPaths} \"$(PODS_ROOT)/#{newFilename}\"" 
     else 
     frameworkPaths = "\"$(PODS_ROOT)/#{newFilename}\"" 
     end 
    end 
    ss.xcconfig = { 
     'FRAMEWORK_SEARCH_PATHS' => frameworkPaths, 
     'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Socializin/Dependency/TwitterDependency"', 
    } 
    #Authentication 
    # ss.dependency 'Fabric' 
    # ss.dependency 'TwitterKit' 
    # ss.dependency 'TwitterCore' 
    end 
end