Reputation: 11751
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" => "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
Upvotes: 7
Views: 3575
Reputation: 24247
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
Upvotes: 10
Reputation: 8715
I'm not very good at Ruby, so I don't understand alloy's example. What I do is just make sure that the xcdatamodeld
is included as a source file, then make a reference in my project to that source file in the Pods directory.
The path ends up looking something like '../Pods/[PathToMyPod]/[MyDataModel].xcdatamodeld'
.
Its a bit of a hack, but it gets the job done easily.
Upvotes: 0
Reputation: 926
Take a look at the following:
https://github.com/CocoaPods/Xcodeproj/issues/81#issuecomment-23142404 https://github.com/Ashton-W/CoreDataPodSample
Upvotes: 1