Search code examples
iosobjective-cxcodeapp-storecoreml

Change .mlmodel auto-generated file forever


In my objective-c project, I use Core ML model for image recognition which generates objective-c .h/.m files for interaction with it.

The problem is that this files contains syntax errors and is not compiled. I can fix them by myself and it will work if I run the app on simulator or device, but I can't create archive for AppStore, because during archiving the file with errors is created anew and build fails.

So could you tell how can I solve this problem?

PS: I took mlmodel from here

Error after archiving the project: enter image description here The problem is that the name of the method misses underscores ("_"). It may be fixed by renaming method like this:

- (instancetype)initWithCategory_softmax_scores:(NSDictionary<NSString *, NSNumber *> *)category_softmax_scores category:(NSString *)category;

Solution

  • I’ve solved this problem by creating new class with the code from files (.h & .m), which generates mlmodel. In this file I fixed all errors. Next I’ve just imported my new file instead of previous (generated) and project has successfully archived.