台风注入 - 使用初始化程序注入参数时崩溃
Typhoon Injection - Crashing when injecting parameters using initializer
我正在按照 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 class 的 "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:")
我正在按照 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 class 的 "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:")