我正在关注Typhoon Coredata示例(https://github.com/appsquickly/Typhoon-CoreData-RAC-Example)以在swift中配置coredata。
但我在以下方法中遇到异常
public dynamic func managedObjectModel() -> AnyObject {
return TyphoonDefinition.withClass(NSManagedObjectModel.self){
(definition) in
definition.useInitializer("contentsOfURL:"){
(initializer) in
initializer.injectParameterWith(self.modelUrl())
}
}
}
在上面的函数中,我试图将modelurl注入NSManagedObjectModel类的“contentsOfURL”方法。但我得到以下错误
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Method 'contentsOfURL:' not found on 'NSManagedObjectModel'. Did you include the required ':' characters to signify arguments?'
//
//NSManagedObjectModel class
public convenience init?(contentsOfURL url: NSURL)
答案 0 :(得分:0)
definition.useInitializer("initWithContentsOfURL:")