Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
HKWorkoutSessionDelegate Not called

I am trying to start a workout session using HKWorkoutSession. It is not starting the session.

    let workoutConfiguration = HKWorkoutConfiguration()
    workoutConfiguration.activityType = .running
    workoutConfiguration.locationType = .outdoor

    do {
        session = try HKWorkoutSession(healthStore: healthStore!, configuration: workoutConfiguration)
        session?.delegate = self
        session?.startActivity(with: Date())
        print((session?.state)!.rawValue)
    } catch let error {
        print(error)
    }

The HKWorkoutSessionDelegate method

func workoutSession(_ workoutSession: HKWorkoutSession, didChangeTo toState: HKWorkoutSessionState, from fromState: HKWorkoutSessionState, date: Date)

Never gets called.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I've seen this a few times (not enough to recreate or anything).

I think restarting Xcode and the Simulator helps.

over 4 years ago · Santiago Trujillo Relatório

0

Are you trying this on simulator? If you are, I'd try on device. If on device, this could be because you haven't accepted HealthKit permissions? Check in Privacy->Health to see if your app has permissions for HealthKit.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda