iOS Testing: dispatch_once get called twice. First in App, second in Test. Problems with Observers
问题 I have a singelton class which will be create in the app delegate. When i run XCTTests then its get create a second time. + (instancetype)urlSchemeManager { static dispatch_once_t onceToken; static UrlSchemeManager* _sharedInstance; dispatch_once(&onceToken, ^{ _sharedInstance = [UrlSchemeManager new]; }); return _sharedInstance; } This is resulting in two different instances. This was no problem if i just use it for unit test. But in the integration test, when i register an observer for