我创建了自己的 CocoaPods Pod 用于我的内部应用程序。这个 Pod 也应该使用 Core Data。我将我的文件 xy.xcdatamodeld 添加到我的源文件中,但它没有编译到 xy.momd 文件夹中。
我是否需要在我的 Pod 中设置任何其他属性才能让 Core Data 工作?
我当前的 pod 文件:
Pod::Spec.new do |s|
s.name = "Test"
s.version = "1.0"
s.summary = "..."
s.homepage = "..."
s.license = 'MIT (example)'
s.author = { "Felix Krause" => "xy@xy.com" }
s.source = { :git => "http://EXAMPLE/Example.podspec.git", :tag => "0.0.1" }
s.platform = :ios, '6.0'
s.source_files = 'TS/Classes/**/*.{h,m}', 'TS/Views/**/*.{h,m}', 'TS/TSResources/**/*.{json,xcdatamodeld}'
s.resources = "TS/TSResources/**/*"
s.frameworks = 'CoreData', 'QuartzCore', 'Accounts', 'MessageUI', 'CoreLocation', 'CoreGraphics', 'MobileCoreServices', 'SystemConfiguration'
s.requires_arc = true
s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/../../TS/**' }
s.ios.xcconfig ={ 'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/../.." "$(PODS_ROOT)/.." "$(SRCROOT)/.."' }
s.xcconfig = { 'OTHER_LDFLAGS' => '-all_load' }
s.dependency 'JSONKit'
end
最佳答案
让我回过头来,它实际上是受支持的。您需要做的就是确保您的 pod 规范在资源下列出了 .xcdatamodeld
。效果如下:
Pod::Spec.new do |s|
s.name = "MyPod"
s.version = "0.1"
s.platform = :ios, '8.0'
s.requires_arc = true
s.public_header_files = 'Pod/Classes/**/*.h'
s.source_files = 'Pod/Classes/**/*{h,m}'
s.resources = 'Pod/Classes/CoreData/*.xcdatamodeld'
s.frameworks = 'CoreData'
end
关于objective-c - 无法访问自己的 CocoaPods Pod 核心数据文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12919451/