Not getting expected results

105 views
Skip to first unread message

Chris Boden

unread,
Feb 8, 2013, 1:59:05 PM2/8/13
to objection...@googlegroups.com
Here is my code:

    JSObjectionInjector *dic = [JSObjection createInjector];

    [JSObjection setDefaultInjector:dic];


    NSArray *test = @[@"Hello", @"World"];

    [dic injectDependencies:test];

    NSArray *check = [dic getObject:[NSArray class]];


    assert([test count] == [check count]);


When I run this the assertion fails.  The debugger confirms test and check are different objects.  Is this a bug or am not using this as intended?

Justin DeWind

unread,
Feb 8, 2013, 4:59:27 PM2/8/13
to Chris Boden, objection...@googlegroups.com
Hi Chris,

injectDependencies does not inject the object into the context. Rather, it will "inject" the dependencies of the object.

If you want to add an object to an injection context you can create a new copy of it using withModules where you could then bind that array to the NSArray class.

-- 
Justin DeWind | Maker
Atomic Object | http://atomicobject.com
[Ph] +1 616 776 6020 [Fx] +1 616 776 6015

--
You received this message because you are subscribed to the Google Groups "Objection iOS/OSX Dependency Injection Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to objection-frame...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages