Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save Food #33

Open
s-turcheniuk opened this issue Apr 17, 2018 · 4 comments
Open

Save Food #33

s-turcheniuk opened this issue Apr 17, 2018 · 4 comments

Comments

@s-turcheniuk
Copy link

I have a few questions about 'save food' feature:

  1. Why it is not presented in read me while it is available in the source code?

  2. I found that saveFood is not very stable. Sometimes it saves food, but most of the time it doesn't. Also, the callback function is not getting called when it doesn't save, which makes it is very hard to suggest what is going wrong. Any thoughts about it?

@s-turcheniuk
Copy link
Author

s-turcheniuk commented Apr 24, 2018

@terrillo Is there an update?

@Eyesonly88
Copy link

Hi @zumaawad and @terrillo, the saveFood method doesn't save all the time and I'm not sure why. Have you guys got this working consistently? is there some configuration that I'm missing?
Can you please help 🙏

@csumrell
Copy link

csumrell commented Jul 20, 2018

@zumaawad @Eyesonly88 would you guys mind sharing your code? Every time I try to use saveFood (or saveWater) my app crashes with EXC_BAD_ACCESS

	let foodOptions = {
		carbohydrates: 25,
		energy: 1000,
		fatTotal: 100,
		protein: 50,
		fiber: 20,
		date:  new Date().toISOString(),
		mealType: "Breakfast",
		foodName: "TestName"
	};

AppleHealthKit.initHealthKit(
		(healthKitOptions: Object),
		(err: string, results: Object) => {
			if (err) {
				console.log("error initializing Healthkit: ", err);
				return;
			}

			AppleHealthKit.saveFood(
				(foodOptions: Object),
				(err: Object, results: Object) => {
					if (err) {
						console.log("error saving water to Healthkit: ", err);
						return;
					}
				}
			);
		}
	);

@svbutko
Copy link
Contributor

svbutko commented Sep 19, 2018

@s-turcheniuk @Eyesonly88 @csumrell I found why it happens and fixed it. The issue was that the file that has saveFood method is not added into the project. This PR fixes it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants