Skip to content

Loading…

Add support for Core Data model #795

Merged
merged 1 commit into from

5 participants

@brutella

Instead of just copying the xcdatamodeld file, it has to be compiled first - like xib and storyboard files.

I've seen a workaround to add Core Data model files as a resource, where the xcdatamodeld file is compiled first and the resulted momd files is added as a resource. I don't like this solutions because it adds overhead to the podspec file and I have to do it for every model file.

I'm not sure why this hasn't been implemented already in the install resources script - seems so obvious...

@brutella brutella Install Core Data model files correctly
Added support to compile Core Data model files before adding to the app bundle.
cde53e9
@panupan

+1

@Ashton-W

Great work! This has been a real pain.

@alloy
CocoaPods member

Awesome, thanks!

@alloy alloy merged commit 2cfc765 into CocoaPods:master

1 check passed

Details default The Travis build passed
@tilowestermann

Great, thanks a million!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 13, 2013
  1. @brutella

    Install Core Data model files correctly

    brutella committed
    Added support to compile Core Data model files before adding to the app bundle.
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/cocoapods/generator/copy_resources_script.rb
View
4 lib/cocoapods/generator/copy_resources_script.rb
@@ -19,6 +19,10 @@ class CopyResourcesScript
echo "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
+ *.xcdatamodeld)
+ echo "xcrun momc ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xcdatamodeld`.momd"
+ xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename $1 .xcdatamodeld`.momd"
+ ;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
Something went wrong with that request. Please try again.