jbsf / blindside

Blindside provides dependency injection capabilities for Objective-C on iOS and OS X
MIT License
71 stars 43 forks source link

Blindside should not attempt to alloc/init or new an instance if the target class doesn't respond to those selectors #24

Closed akitchen closed 9 years ago

akitchen commented 9 years ago

In the case where a class has a required/designated instance initializer, and the developer hasn't yet provided a BSInitializer, Blindside should raise an appropriate exception with helpful recovery info (e.g. instructions to override +BSInitializer)

briancroom commented 9 years ago

I believe this is difficult or impossible to achieve because designated initializer information is not made available at runtime, as far as I know.

OTOH it may be a reasonable heuristic that if a given class declares one or more initializers that are not present in its superclass, then we could assume that a +bsInitializer should be provided and throw an exception if that isn't the case?