Search code examples
swiftcocoapodscoreml

Cocoapods not including additional files


I have a cocoapod I've built which makes use of Apples new coreml library. As such it has several .mlmodel files that it makes use of to do data categorization etc.

The issue I am facing is that when I add the pod to another project and run a pod install it installs the pod as required, but the .mlmodel files are all missing - meaning the class files they generate are not found, so as such if I try to do a build, it fails. I know that .mlmodel files are a bit special as they are static files that generate a class on compilation, but I'm not sure how to force them to be included as files in the pod.

I have tried using smaller models in case it was a file size issue, ala the 100MB limit that git has for example, but this did not help. I'm not sure how to deal with it, as a static image file, for example, works fine.

Currently, I just manually drag the .mlmodel files into the pod folder after I've done an install, but this obviously is not a feasible method for build servers etc.


Solution

  • Use preserve_paths in the podspec for the .mlmodel files.