timfraedrich/OutRun

Cycling Distance don't sync to Apple Health

ArthurPereira opened this issue · 8 comments

The app stopped syncing Cycling Distance to Apple Health after version 1.2 even it having write permission to Cycling Distance category on Apple Health.

That is weird, I just tested it and it seems to work for me. Are you sure it does not sync? Where have you checked?

Yes, I just checked Cycling Distance data in Apple Health and the last data was saved before I update to version 1.2. Workouts data are saved without any problem.

It may be happening because I didn't give OutRun permission to save data to Steps category in Apple Health. Health app already have access to iPhone's Motion Tracking capability to automatically save steps data, so I didn't want duplicate data in Apple Health.

So how it should work today is, when saving a workout the app checks if it has all the permissions it requested, otherwise it should not save anything, this is obviously a point of improvement, but seemed right at the time of coding it.

What's going on in your case I have no idea, normally when even one permission to write or read is missing, the saving of anything shouldn't work.

Maybe for clarity: Do any of the other samples get saved, so does the workout have an attached route, calories or steps sample?

At last just a side note: The app retrieves steps the same way the system does (from a system service), so there should be not difference in the data and if there are two samples at the same time (from the system and OutRun) it just picks one to avoid incorrect data.

Yes, it is saving Workouts data, but it seems to not be including the Cycling Distance sample in the Workout sample, even it showing the total cycling distance correctly. The same is occurring with Active Energy as well. However the Workout sample has the route data though.

I had already imagined that iOS would choose a Steps data at a certain time to avoid duplicating data that would result in incorrect information in the Health app, but I was not willing to try that.

Okay after looking into it for a bit the only possible thing I could come up with is that in the process of saving the samples (which are all saved together) it fails because there is no permission for the steps sample. The other samples will get attached to the workout but not properly saved?

There is a question mark after the last part because I cannot explain it to myself, that is not how the system is supposed to work.

I will have to do a bit of testing to confirm my theory and to come up with a possible solution. Just one last question: Have you tried it while steps are enabled and if so does the issue persist?

There seems to be an overall problem regarding the synchronisation with Apple Health, so I created another issue to keep track of the whole problem in one thread.

Please refer to #14 for future updates.