Cannot invalidate a scheduled WKExtendedRuntimeSession

I'm trying to schedule a Smart Alarm on a specified time, the scheduling works, and it fires, but I cannot cancel it once scheduled.


Anyone tried it? Here is my code


run = WKExtendedRuntimeSession()

run.delegate = self

var timerStartTime:TimeInterval = 60

run.start(at: Date(timeIntervalSinceNow: timerStartTime))



...less than 60s later


run.invalidate()


...console gives error


Test WatchKit Extension[51858:2541440] [sessions] encountered error Error Domain=CSLSSessionErrorDomain Code=3 "No record that <CSLSession: 0x7e8b1940; pid: 51858; dismissed: YES; duration: 1800.0; autoEnd: NO; launchable: NO; mutuallyExclusive: YES; managed: YES; persisted: NO; _cpuPercentage: 0.0; schedulable: YES; requiresFGActiveInitiation: YES; lastForeground: 2019-07-18 15:32:33 +0000> |CSLSSession = {

| sessionID: 5CE52D42-F62E-4807-B0BD-631D623E94F6; bundleID: MC.Test.watchkitapp; type: scheduled; running: NO; expirationDate: 0x0; startDate: 2019-07-18 15:32:38 +0000; lastStartWasScheduled: NO;

|} was started" UserInfo={NSLocalizedDescription=No record that <CSLSession: 0x7e8b1940; pid: 51858; dismissed: YES; duration: 1800.0; autoEnd: NO; launchable: NO; mutuallyExclusive: YES; managed: YES; persisted: NO; _cpuPercentage: 0.0; schedulable: YES; requiresFGActiveInitiation: YES; lastForeground: 2019-07-18 15:32:33 +0000> |CSLSSession = {

| sessionID: 5CE52D42-F62E-4807-B0BD-631D623E94F6; bundleID: MC.Test.watchkitapp; type: scheduled; running: NO; expirationDate: 0x0; startDate: 2019-07-18 15:32:38 +0000; lastStartWasScheduled: NO;

|} was started}

Cannot invalidate a scheduled WKExtendedRuntimeSession
 
 
Q