我正在尝试在里面创建一个包含CoreData模型的pod。我已按照提示使用resources
和reserve_path
。但是,当我尝试使用lint
pod lib lint
时,我会发现这个奇怪的错误:
- 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.
该规范基于几个子规格,这可能会使问题复杂化。到目前为止,在互联网上搜索并没有提供任何帮助。
如果有人愿意看一下,有一个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' => 'rzolin@gmail.com' }
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 :(得分:4)
我遇到了与您相同的问题和错误消息。
我希望在我的广告连播中有.xcdatamodel
。
这是我的解决方案:
仅在source_files中添加您的代码:
s.source_files = 'MyPodDiR/**/*.{h,m,swift,xcdatamodeld}'
将您的xcdatamodel
路径添加为资源:
s.resources = 'MyPodDir/CoreData/MyPodModel*.xcdatamodeld'
答案 1 :(得分:0)
我遇到了同样的问题,包括SampleMessengerCocoapodFramework/Code/DataManagement/**/*
你包含了所有文件(因此pod尝试包含.xcdatamodel/xcdatamodeld
文件,这就是你收到错误的地方。
我建议从源文件中删除coredatamodel
。
即s.source_files = 'SampleMessengerCocoapodFramework/Code/DataManagement/**/*.{h,m}'
保持原样,它应该有效!