0

I read about HKWorkoutSession and they said that if I'm using HKWorkoutSession without using it for recording a workout app, it will be rejected on the App Store.

So what else is there that can keep running the app in background activity? Examples like Music App, Workout App, and Nike Running Club, if start they will have the app logo on the above screen like notification badges.

Also, if the user press the digital crown or open another app, it will automatically reopen after a few minutes of inactivity while the session is still running.

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
Mardydu
  • 45
  • 1
  • 7

1 Answers1

1

There is a very short list of reasons your app is allowed in the background.

From the documentation:

  • Use an HKWorkoutSession object to start and stop workouts.

  • Use the AVAudioSession class to play extended audio files in the background.

  • Use a CLLocationManager object to start a continuous background location session.

If your app doesn't do any of those things then it's not allowed to function in the background for more than a few seconds.

An alternative is using Background Tasks, which allows your app to execute some tasks either on a schedule or as a response to connectivity updates. Background Tasks, however, doesn't mean that your app can remain open like with background sessions.

EmilioPelaez
  • 18,758
  • 6
  • 46
  • 50
  • I see! the links above is very helpful, but how about like Timer App? Does it use the "Background Tasks" one? Because it countdowns the timer even while inactive and automatically reopen the app if time is up. Anyway thank you for responding so fast! – Mardydu May 19 '21 at 12:19
  • Apple's apps often get around limitations, so you shouldn't use them as reference. – EmilioPelaez May 19 '21 at 12:26