 	@objc(Webtrekk_viewWillDisappear:)
 	private dynamic func swizzled_viewWillDisappear(animated: Bool) {
 		self.swizzled_viewWillDisappear(animated)
-		guard let observer = applicationWillEnterForegroundObserver else {
-			return
+
+		if let applicationDidBecomeActiveObserver = applicationDidBecomeActiveObserver {
+			NSNotificationCenter.defaultCenter().removeObserver(applicationDidBecomeActiveObserver)
+			self.applicationDidBecomeActiveObserver = nil
 		}
-		NSNotificationCenter.defaultCenter().removeObserver(observer)
-		applicationWillEnterForegroundObserver = nil
-		didAppearBefore = false
 	}
 }

	}


	internal var didAppearBefore: Bool {
		get { return objc_getAssociatedObject(self, &AssociatedKeys.didAppearBefore) as? Bool ?? false }
		set { objc_setAssociatedObject(self, &AssociatedKeys.didAppearBefore, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) }
	}


	@nonobjc
	internal static func setUpAutomaticTracking() {
		guard !swizzled else {


	private struct AssociatedKeys {

		private static var applicationDidBecomeActiveObserver = UInt8()
		private static var automaticTracker = UInt8()
	}


