I have very annoying problem with Typhoon Framework version 2.3.0 in Swift project.
I included Typhoon in Podfile as mentiond in tutorial, installed Pods, created bridging header and added #import <Typhoon/Typhoon.h>
in this header.
Then I created assembly subclass called ApplicationAssebly :
import Foundation
public class ApplicationAssembly: TyphoonAssembly {
public dynamic func appDelegate() -> AnyObject {
return TyphoonDefinition.withClass(AppDelegate.self) {
(definition) in
definition.injectProperty("myAssembly", with: self)
}
}
}
As you see I want to inject that assembly into AppDelegate. I have also added TyphoonInitialAssemblies entry in Info.plist file. And in this moment my problems has started. I have tested few combinations resulting in NSException :
Can't resolve assembly for name xxx
This combinations are (typhtest is project/bundle name):
- ClassName in Info.plist: ApplicationAssembly, Defines Module property in Build Settings : No
- ClassName in Info.plist: ApplicationAssembly, Defines Module property in Build Settings : Yes
- ClassName in Info.plist: typhtest.ApplicationAssembly, Defines Module property in Build Settings : No
- ClassName in Info.plist: typhtest.ApplicationAssembly, Defines Module property in Build Settings : Yes
I have found this answer on StackOverflow so I've tried the last combination :
- ClassName in Info.plist: _TtC8typhtest19ApplicationAssembly, Defines Module property in Build Settings : Yes
This combination doesn't throw NSException but I have dyld_fatal_error, stack trace from iPhone 5s (iOS 7.1) below :
I get slightly different stack trace from iPhone simulator (iOS 7.1) :
What is strange that it works on iOS 8.1 simulator ! Also Typhoon Sample Application for Swift works well on my device.
I also tried to clean any Xcode and project caches and DerivedData directories, I've cleaned project and build folder and rebuilded the project, but it's not working. My Xcode version is 6.1 (6A1052d) and I'm using OSX Yosemite 10.10.1 .
GitHub repository with my code : https://github.com/papcio28/Typhoon-Dyld-Error
Edited 21.11.2014
What is also strange is that if I create the factory manually and inject something also manually, Typhoon works. Steps that I've made are :
- Removed
TyphoonInitialAssemblies
item from Info.plist Changes
AppDelegate.application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool
tofunc application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { let factory = TyphoonBlockComponentFactory(assemblies: [AppAssembly()]) factory.inject(self) return true }
But it doesn't change a fact that I want to use Typhoon without defining factory manually, so the question is still actual.