當我呼叫 api finishExtendedLaunchMeasurement 時,Xcode 拋出錯誤:
[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.}
以下代碼:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// create window
MXMetricManager.shared.add(self)
do {
let task_id = MXLaunchTaskID("1234.zmmm")
try MXMetricManager.extendLaunchMeasurement(forTaskID: task_id)
print("some task perform")
try MXMetricManager.finishExtendedLaunchMeasurement(forTaskID: task_id)
} catch {
print(error)
}
return true
}
我該如何解決這個問題?
uj5u.com熱心網友回復:
您不應在此處呼叫 finishExtendedLaunchMeasurement,因為該應用程式并未在此處完全啟動。就這樣做,或者你想要的任何其他時間,比如顯示的第一個螢屏
dispatch_async(dispatch_get_main_queue(), ^{
if (@available(iOS 16.0, *)) {
[[MetricsManager shared] finishLaunchMeasurement];
}
});
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/522866.html
標籤:IOS公制套件
