Unable to Access CocoaPods Pod Core Native Data File

I created my own CocoaPods Pod for use inside my applications. This Pod should also use Core Data. I added the xy.xcdatamodeld file to my source files, but was not compiled to the xy.momd folder.

Do I need to set any other properties in my Pod in order to get Core Data working?

My current page 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 
+6
source share
4 answers

Just so I can get back to this, it is actually supported. All you have to do is make sure your pod specifier lists .xcdatamodeld in resources. Sort 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 
+9
source

There is currently no explicit support for this. Here is an example of how you could do this. Please note, however, that this code was untested, but it should be something like that. This particular user moved the model definition into code, in the end, by the way.

NTN

+2
source

I am not very good at Ruby, so I do not understand the alloy example. What I'm doing is just make sure xcdatamodeld included as the source file, and then make a link in my project to this source file in the Pods directory.

The path ends with what looks like '../Pods/[PathToMyPod]/[MyDataModel].xcdatamodeld' .

Hack it a little, but it easily copes with its task.

0
source

Source: https://habr.com/ru/post/927863/


All Articles