2017-08-24 109 views
3

我想創建一個與CoreData模型內的pod。我已按照提示使用resourcesreserve_path。但是,當我嘗試lint規範與pod lib lint有這個奇怪的錯誤,我甚至不明白:CocoaPod spec:無法找到Model.xcdatamodeld的其他來源參考

- ERROR | [iOS] unknown: Encountered an unknown error (Unable to find other source ref for /Users/rzolin/Projects/ArmorText/iOS-Pod-Test/SampleMessengerCocoapodFramework/SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld/Model.xcdatamodel/contents for target SampleMessengerCocoapodFramework.) during validation. 

該規範是基於幾個subspecs,這可能有點複雜的問題。到目前爲止,在互聯網上搜索沒有產生任何幫助。

有一個test spec複製錯誤,如果有人願意看看。

完整的規範是在這裏:

Pod::Spec.new do |s| 
    s.name    = 'SampleMessengerCocoapodFramework' 
    s.version   = '0.2.0' 
    s.summary   = 'some desc' 

    s.description  = <<-DESC 
    some desc 
    DESC 

    s.homepage   = 'http://www.example.com' 
    s.license   = { :type => 'MIT', :file => 'LICENSE' } 
    s.author   = { 'rzolin' => '[email protected]' } 
    s.source   = { :git => 'https://github.com/rzolin/SampleMessengerCocoapodFramework.git', :tag => s.version.to_s } 

    # Platform setup 
    s.requires_arc = true 
    s.ios.deployment_target = '8.0' 

    s.default_subspec = 'Core' 

    ### Subspecs 
    s.subspec 'Core' do |cs| 
     cs.dependency 'SampleMessengerCocoapodFramework/DataManagement' 
     cs.dependency 'SampleMessengerCocoapodFramework/Networking' 
    end 

    s.subspec 'DataManagement' do |ds| 
    ds.source_files = 'SampleMessengerCocoapodFramework/Code/DataManagement.h', 'SampleMessengerCocoapodFramework/Code/DataManagement/**/*' 
     ds.resources = [ 'SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld', 'SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld/*.xcdatamodel' ] 
     ds.preserve_paths = 'SampleMessengerCocoapodFramework/Code/DataManagement/Model/Model.xcdatamodeld' 
    end 

    s.subspec 'Networking' do |ns| 
    ns.source_files = 'SampleMessengerCocoapodFramework/Code/Networking.h', 'SampleMessengerCocoapodFramework/Code/Networking/**/*.{h,m,swift}' 
    end 

    # s.resource_bundles = { 
    # 'SampleMessengerCocoapodFramework' => ['SampleMessengerCocoapodFramework/Assets/*.png'] 
    # } 

    # s.public_header_files = 'Pod/Classes/**/*.h' 
    # s.frameworks = 'UIKit', 'MapKit' 
    # s.dependency 'AFNetworking', '~> 2.3' 
end 

我試着問的CocoaPods的question,但在這裏

提到任何幫助,將不勝感激!

+0

做你管理找到解決這個問題的辦法? – Mateusz

回答

0

我有同樣的問題,通過包括SampleMessengerCocoapodFramework/Code/DataManagement/**/*要包括所有文件(這樣莢嘗試包括.xcdatamodel/xcdatamodeld文件,這就是你的錯誤。

我建議從源頭文件coredatamodel

s.source_files = 'SampleMessengerCocoapodFramework/Code/DataManagement/**/*.{h,m}'

並保留其餘部分是,它應該工作!

2

我有同樣的問題和錯誤消息你。 我想在我的pod中擁有.xcdatamodel。 這裏是我的解決方案:

  1. 只添加您的代碼在SOURCE_FILES:

    s.source_files = 'MyPodDiR/**/*.{h,m,swift,xcdatamodeld}' 
    
  2. 添加您xcdatamodel路徑作爲資源:

    s.resources = 'MyPodDir/CoreData/MyPodModel*.xcdatamodeld' 
    
相關問題