0
當我繼承RBAppDelegate並覆蓋application:didFinishLaunchingWithOptions:
它從未執行。有一些提示呢?應用程序:didFinishLaunchingWithOptions:子類化時不執行RBAppDelegate
class AppDelegate: RBAppDelegate {
override func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
super.application(application, didFinishLaunchingWithOptions: launchOptions)
// won't be executed...
configureStuff()
return true
}
}
只需清楚:我有一個'class AppDelegate:RBAppDelegate',它帶有'override init()'(沒有其他的地方),其中創建了類AppDelegateObserver:NSObject,RBAppDelegateObserver的一個實例,並將它添加爲觀察者'observers.addObserver(AppDelegateObserver())'。在AppDelegateObserver中,我實現了一個'applicationDidFinishLaunching'並將它作爲發佈後配置的地方?這是預期的方式,它用於註冊多個觀察者,它本身會對 - 'RBAppDelegateObserver'看起來像 - 常規事件,'UIApplicationDelegate'使用? – RyuX51
是的,這是正確的。使用這種方法,您可以爲UIApplicationDelegate事件提供多個觀察者。 –