[英]Typhoon Injection - Crashing when injecting parameters using initializer
我正在遵循Typhoon Coredata示例( https://github.com/appsquickly/Typhoon-CoreData-RAC-Example )快速配置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)
definition.useInitializer("initWithContentsOfURL:")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.