Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

147
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda