访问程序集的子程序集将生成EXC_BAD_ACCESS

时间:2015-07-28 18:23:39

标签: ios typhoon

用例:

我有一个ApplicationAssembly。此程序集具有名为TyphoonAssembly类型的CoreAssembly的属性。我正在使用PLIST集成并注册了两个程序集。我将ApplicationAssembly注入到Appdelegate中。

ViewController中的Afterwads,我想得到一个将由CoreAssembly生成的对象

    var appdelegate = UIApplication.sharedApplication().delegate as!  AppDelegate;
  tagHandler = appdelegate.assembly.coreAssembly.tagHandler() as! GoogleTagsHandler;

如果我这样做,我会得到一个EXC_BAD_ACCESS

1 个答案:

答案 0 :(得分:2)

This seems to be a bug, we've logged it. In the meantime, as a workaround, please inject both ApplicationAssembly and CoreAssembly into your app delegate as follows:

public dynamic func appDelegate() -> AnyObject {
    return TyphoonDefinition.withClass(AppDelegate.self) {
        (definition) in

        definition.injectProperty("assembly", with: self)
        definition.injectProperty("coreAssembly", with: self)
    }
}