Closed sw8fbar closed 8 years ago
Figured it out. Need to set the modelClass for the Repository
@sw8fbar hi, I am having the exactly problem as you mentioned in this issue, can you provide some pointers on what you mean in your comment exactly? Thanks a lot!
hi Kevin, Try this in your repository definition, replace Organization with your Swift Model Name
override init!(className name: String!) {
super.init(className: "Orgs")
self.modelClass = Organization.self
}
override init(){
super.init(className: "Orgs")
self.modelClass = Organization.self
}
Instead of specifying the modelClass, you can also import CoreData
in your model repository. That should fix the problem too.
Thanks a lot @sw8fbar ! That really fix the problem!
Hi I am using swift with the loopback-sdk-ios. The code is as follows
`import Foundation
class Organization : LBPersistedModel {
}
class OrgRepositories : LBPersistedModelRepository {
}
class AppDelegate: UIResponder, UIApplicationDelegate {
}
class AppSetupViewController: UIViewController {
} `
The following is the error. Could you please help with identifying the reason?
2016-02-20 12:46:35.593 m1c[44996:5948913] -[LBModel setId:]: unrecognized selector sent to instance 0x7fc593479a70 2016-02-20 12:46:35.612 m1c[44996:5948913] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[LBModel setId:]: unrecognized selector sent to instance 0x7fc593479a70' *** First throw call stack: ( 0 CoreFoundation 0x000000010866ce65 __exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000108e57deb objc_exception_throw + 48 2 CoreFoundation 0x000000010867548d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x00000001085c290a ___forwarding___ + 970 4 CoreFoundation 0x00000001085c24b8 _CF_forwarding_prep_0 + 120 5 m1c 0x0000000106489da5 -[LBPersistedModelRepository modelWithDictionary:] + 165 6 m1c 0x000000010648a8da __53-[LBPersistedModelRepository allWithSuccess:failure:]_block_invoke_2 + 106 7 CoreFoundation 0x00000001085c3f84 __NSArrayEnumerate + 596 8 m1c 0x000000010648a804 __53-[LBPersistedModelRepository allWithSuccess:failure:]_block_invoke + 612 9 m1c 0x00000001064b2e72 __103-[SLRESTAdapter requestWithPath:verb:parameters:bodyParameters:multipart:outputStream:success:failure:]_block_invoke105 + 98 10 m1c 0x00000001064a3a03 __66-[SLAFJSONRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke91 + 51 11 libdispatch.dylib 0x000000010adf8e5d _dispatch_call_block_and_release + 12 12 libdispatch.dylib 0x000000010ae1949b _dispatch_client_callout + 8 13 libdispatch.dylib 0x000000010ae012af _dispatch_main_queue_callback_4CF + 1738 14 CoreFoundation 0x00000001085ccd09 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 15 CoreFoundation 0x000000010858e2c9 __CFRunLoopRun + 2073 16 CoreFoundation 0x000000010858d828 CFRunLoopRunSpecific + 488 17 GraphicsServices 0x000000010a571ad2 GSEventRunModal + 161 18 UIKit 0x0000000106d43610 UIApplicationMain + 171 19 m1c 0x000000010645cbfd main + 109 20 libdyld.dylib 0x000000010ae4d92d start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)