MXMetricKit: finishExtendedLaunchMeasurement not work

Xcode throw an error when i call the api finishExtendedLaunchMeasurement :

 [General] Couldn't find persisted ALM/FrontBoard launch signpost id when finishing an ext launch task.


Error Domain=MXErrorDomain Code=5 "Internal failures happened inside of MetricKit." UserInfo={NSLocalizedDescription=Internal failures happened inside of MetricKit.}

how i can fix this problem?

Replies

The following code


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // create window

    MXMetricManager.shared.add(self)
    do {
      try MXMetricManager.extendLaunchMeasurement(forTaskID: MXLaunchTaskID("1234.zmmm"))
      print("some task perform")
      try MXMetricManager.finishExtendedLaunchMeasurement(forTaskID: MXLaunchTaskID("1234.zmmm"))
    } catch {
      print(error)
    }
    return true
  }