You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However when I run the code the commsX argument is nil. I've tried to follow the Objection code and it appears that it is building an instance of the Comms object and putting it into it's context. However it's not passed through to the code that actually creates the instance of this code.
Am I doing anything wrong? I found the sample code on the Objection website rather difficult to follow :-(
The text was updated successfully, but these errors were encountered:
By using objection_initializer you define that this is the initializer that will be called when you fetch it from the injector (or factory), but you need to either provide default arguments (additional arguments to objection_initializer) or to use getObjectWithArgs: / getObject:arguments: / getObject:argumentList: and provide the arguments.
Note that the downside of fetching objects in that manner is that you lose type safety, and that you cannot provide primitive objects as arguments.
Ahh, ok. I thought that Objection would look at the arguments and then look for matching objections in it's context.
When I was debugging through trying to see how it works, I saw Objection load the Comms singleton first. Then when it went to can the initWithComms, I could see the Comms object in the _context variable of the code that was doing the loading. So it looked like Objection could have set it into the arguments array it was passing to the load code. Presuming it could examine the init's signature and deduce what it was looking for.
As there isn't anywhere in the code where Comms is initialised (It's currently being handled by Objection) I was hoping it would be able to figure this out by itself.
Anyway. I'll have a play and see how I go. Thanks :-)
I have the following initialiser in a class:
However when I run the code the commsX argument is nil. I've tried to follow the Objection code and it appears that it is building an instance of the Comms object and putting it into it's context. However it's not passed through to the code that actually creates the instance of this code.
Am I doing anything wrong? I found the sample code on the Objection website rather difficult to follow :-(
The text was updated successfully, but these errors were encountered: