I created my own CocoaPods Pod to use for my apps internally. This Pod should also use Core Data. I added my file xy.xcdatamodeld to my source files but it's not compiled into a xy.momd folder.
Do I need to set any other properties in my Pod to get Core Data to work?
My current pod file:
Pod::Spec.new do |s|
s.name = "Test"
s.version = "1.0"
s.summary = "..."
s.homepage = "..."
s.license = 'MIT (example)'
s.author = { "Felix Krause" => "[email protected]" }
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
Just so I can come back to this, it is actually supported. All you need to do is ensure that your pod spec lists the .xcdatamodeld
under resources. Something to the effect of:
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
There is currently no explicit support for this. Here is an example of how you could do it. Note, however, that that code was untested, but it should be something along those lines. That specific user moved the model definition into code, in the end, btw.
HTH
Take a look at the following:
https://github.com/CocoaPods/Xcodeproj/issues/81#issuecomment-23142404 https://github.com/Ashton-W/CoreDataPodSample
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With