Build errors in autogenerated CoreML model class

I just upgraded to Xcode 10.0 which seemingly broke the CoreML autogenerated network class code. When building the project, I receive the error:


`reg_net.m:94:50: No visible @interface for 'reg_netInput' declares the selector 'initWith0:'`


Inside the class, the autogenerated `reg_netInput` initializer has the form `initWith_0` but in the body of the prediction function, the code calls `initWith0`. I've tried to change the initializer names to be consistent but whenever I build, the code seemingly autogenerates again and reverts to the conflicting names. I've also tried downloading Xcode 9.4.1 and building but it produces even more build errors such as flagging "MLModelConfiguration" with "Expected a type" and "No known class method for selector modelWithContentsOfURL:configuration:error:" or "No known instance method for selector 'featuresAtIndex:'".


I've also tried deleting and re-importing the .mlmodel files without success. Any ideas on how to fix this?

Accepted Reply

My guess is that the code generator doesn't handle the name of your model's input ("0" it seems) very well. Maybe you could try giving the model inputs more descriptive names that are not just a number.


Alternatively you can create you own wrapper class with the methods provided by MLModel (just check out what the generated code does) or use MLModel direclty without a wrapper.

Replies

My guess is that the code generator doesn't handle the name of your model's input ("0" it seems) very well. Maybe you could try giving the model inputs more descriptive names that are not just a number.


Alternatively you can create you own wrapper class with the methods provided by MLModel (just check out what the generated code does) or use MLModel direclty without a wrapper.