简体   繁体   中英

Accessing sub assembly of an assembly will generate EXC_BAD_ACCESS

Use case:

I have an ApplicationAssembly. This assembly has a property called CoreAssembly of type TyphoonAssembly. I'm using PLIST integration and have registered both Assemblies. I'm injecting the ApplicationAssembly into the Appdelegate.

Afterwads in a ViewController, I want to get an object which will be generated by CoreAssembly

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

If I do this, I get an EXC_BAD_ACCESS

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)
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM