Xcode Testing ML model for your app without running on the device

As of this writing, testing the image detection ML model inside the simulator (I am using Xcode 14.0 beta 3), won’t work if you are targeting iOS or iPadOS, you have to use an actual device. But now I stumbled onto the fact that if you can make your app, run for the “My Mac (Designed for iPad)” target, you can actually test the ML model without installing it on an actual device. So next time you need to work on the integration of an ML model in your app, you can use the “My Mac (Designed for iPad)” target, and move trough development without a problem. I do hope in future versions, you will be able to run ML models inside the simulator.

Error – The VNCoreMLTransform request failed

If you are working with the vision framework and you are getting this error, while testing the iOS app in simulator, well, test it on the actual device and see if the error goes away. Very unfortunate error description.

This was very confusing personally, since the code was working fine while I was using it on an macOS app. Also I did not find any warnings anywhere that you are supposed to only test it on an actual device. Not sure how this makes any sense, but glad that I figure it out, It drove me crazy for the last 2 days.