GithubHelp home page GithubHelp logo

gregwilson / react-native-apple-healthkit Goto Github PK

View Code? Open in Web Editor NEW
176.0 176.0 42.0 863 KB

A React Native bridge module for interacting with Apple HealthKit data

Objective-C 98.10% JavaScript 1.90%

react-native-apple-healthkit's People

Contributors

benjaminpaap avatar gregwilson avatar skleest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-apple-healthkit's Issues

Workouts, calories and sleep

Hi,

Since iOS 10 (maybe before but I've just noticed the change since then) it's possible to get sleep analysis, is it implemented?

Same question concerning calories and workouts

Trying to run: Error :CFBundleIdentifier

I have already try to follow step by step in README.md but I cannot run example
This is error log:
** BUILD FAILED **

The following build commands failed:

    CompileC /Users/lethanhtan/Desktop/react-native-apple-healthkit-master/examples/TestHealthy/ios/build/Build/Intermediates/RCTAppleHealthKit.build/Debug-iphonesimulator/RCTAp

pleHealthKit.build/Objects-normal/x86_64/RCTAppleHealthKit.o RCTAppleHealthKit/RCTAppleHealthKit.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/TestHealthy.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/TestHealthy.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Anyone knows about this project? Help me :)

Header paths with RN 0.40 causes errors.

The header paths for React Native libraries have now been namespaced. #import "RCTBridge.h" is now #import <React/RCTBridge.h>

I am happy to make a PR with the fix :)

Some identifiers not compatible with version smaller than iOS 9.3

I recently found this error where the identifier HKQuantityTypeIdentifierAppleExerciseTime was crashing the app for iOS versions smaller than 9.3+. Removing that from our fork resolved the issue.

I then checked our log and found a few other ones where it complained about non-supported identifiers, however they didn't seem to crash the app. Not sure which ones exactly but here's list of the files it was generating warnings for:

  • RCTAppleHealthKit.o
  • RCTAppleHealthKit+Queries.o
  • RCTAppleHealthKit+Methods_Nutrition.o
  • RCTAppleHealthKit+Utils.o
  • RCTAppleHealthKit+Methods_Body.o
  • RCTAppleHealthKit+Methods_Results.o
  • RCTAppleHealthKit+Methods_Vitals.o
  • RCTAppleHealthKit+Methods_Characteristic.o
  • RCTAppleHealthKit+TypesAndPermissions.o
  • RCTAppleHealthKit+Methods_Fitness.o

Build getting failed

I'm using following things:
React Native: 0.46.1
react-native-apple-healthkit: 0.2.1

What I did:
I install react-native-apple-healthkit
then I run command: react-native link
Problem is: When I'm running project from Xcode, It's giving me error : Duplicate interface definition for class "RCTBridge"

Can anyone please help me on above?

Thanks, In advance.

Crash Stack (potentially date/calendar related)

Thank you for building this library. We use it and have seen this crash stack. We aren't sure what's causing it but can provide feedback on how it might have happened. Thanks!

com.apple.main-thread
0  libicucore.A.dylib             0x186a64830 icu::UnicodeString::releaseArray() + 48
1  libicucore.A.dylib             0x186a647a8 icu::UnicodeString::~UnicodeString() + 36
2  libicucore.A.dylib             0x186ade840 icu::DateFormatSymbols::dispose() + 264
3  libicucore.A.dylib             0x186adee04 icu::DateFormatSymbols::~DateFormatSymbols() + 36
4  libicucore.A.dylib             0x186adee38 icu::DateFormatSymbols::~DateFormatSymbols() + 12
5  libicucore.A.dylib             0x186b509b8 icu::SimpleDateFormat::adoptCalendar(icu::Calendar*) + 168
6  CoreFoundation                 0x1878d8a34 __cficu_udat_setCalendar + 28
7  CoreFoundation                 0x1878789cc __ResetUDateFormat + 2056
8  CoreFoundation                 0x187877fa0 __SetUpCFDateFormatter + 372
9  Foundation                     0x18833d5e0 -[NSDateFormatter _regenerateFormatter] + 284
10 Foundation                     0x1882fe9b8 -[NSDateFormatter stringForObjectValue:] + 152
11 ASX                        0x1000afe74 +[RCTAppleHealthKit(Utils) buildISO8601StringFromDate:] + 4295556724
12 ASX                        0x1000adb04 __99-[RCTAppleHealthKit(Queries) fetchQuantitySamplesOfType:unit:predicate:ascending:limit:completion:]_block_invoke_2 + 4295547652
13 libdispatch.dylib              0x1867761fc _dispatch_call_block_and_release + 24
14 libdispatch.dylib              0x1867761bc _dispatch_client_callout + 16
15 libdispatch.dylib              0x18677ad68 _dispatch_main_queue_callback_4CF + 1000
16 CoreFoundation                 0x18789a810 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
17 CoreFoundation                 0x1878983fc __CFRunLoopRun + 1660
18 CoreFoundation                 0x1877c62b8 CFRunLoopRunSpecific + 444
19 GraphicsServices               0x18927a198 GSEventRunModal + 180
20 UIKit                          0x18d80d7fc -[UIApplication _run] + 684
21 UIKit                          0x18d808534 UIApplicationMain + 208
22 ASX                        0x10004420c main (main.m:16)
23 libdispatch.dylib              0x1867a95b8 (Missing)

Looking for collaborators

I am currently looking for collaborators to work on this project with a potential path to taking over the repo.

Please reply below if you are interested.

How to access HKAuthorizationStatus??

Sorry if this may seem like a dumb question, I was wondering how do access the HKAuthorizationStatus constants to ensure that the user hasn't turned off permissions or have actually given permissions??

Thanks!

_reactNativeAppleHealthkit2.default.isAvailable is not a function

Hello everybody,

this is my current Code:

import React, { Component } from "react";
import { Image, View } from 'react-native';
import { Container, Icon, DeckSwiper, Card, CardItem, Left, Right, Body, Thumbnail, Text } from 'native-base';
import AppleHealthKit from 'react-native-apple-healthkit';

const HKPERMS = AppleHealthKit.Constants.Permissions;
const HKOPTIONS = {
    permissions: {
        read:  [
            HKPERMS.StepCount,
            HKPERMS.DistanceWalkingRunning,
            HKPERMS.FlightsClimbed,
            HKPERMS.Height,
            HKPERMS.DateOfBirth,
            HKPERMS.BiologicalSex,
            HKPERMS.SleepAnalysis,
        ],
        write: [
            HKPERMS.StepCount
        ],
    }
};

class Health extends Component{
    constructor(props){
        super(props);

    }

    componentDidMount(){

        AppleHealthKit.isAvailable((err, res) => {
            if(err) {
                console.log("error initializing healthkit: ", err);
                return;
            }
            // healthkit initialized...
        });
    }

    render(){


        return(
            <Text>tbd</Text>
        )
    }
}

export default Health;

The Moment the function isAvailable is called i get the following error:

Unhandled JS Exception: _reactNativeAppleHealthkit2.default.isAvailable is not a function
reactConsoleErrorHandler @ ExceptionsManager.js:71
console.error @ YellowBox.js:62
logIfNoNativeHook @ RCTLog.js:38
__callFunction @ MessageQueue.js:242
(anonymous) @ MessageQueue.js:108
guard @ MessageQueue.js:46
callFunctionReturnFlushedQueue @ MessageQueue.js:107
(anonymous) @ debuggerWorker.js:71

I am using the current version from npm.

Can you please help me in finding a way to start to fix this problem? I did every step in the README. Is it possible that i missed something while configuring the XCode-Project?

is it possible to use `authorizationStatus(for:)` ?

https://developer.apple.com/reference/healthkit/hkhealthstore/1614154-authorizationstatus

README saids

For any data that is read from HealthKit the status/error is the same for both. This privacy restriction results in having no knowledge of whether the permission was denied (make sure it's added to the permissions options object), or the data for the specific request was nil (ex. no steps recorded today).

but I think if I can know whether the permission was denied or the data was nil by using authorizationStatus(for:). so I wish I could use this.. is it implemented?

thanks.

Calories Burnt Data

How can I get the calories burnt data from the apple watch Healthkit in react native?

RCTBridgeModule.h not found

Hello,

I followed the installation instructions verbatim and still encounter the aforementioned error. Any idea what I may be doing incorrectly?

Try to run, the error

install: npm install --save react-native-apple-healthkit
so cd & run react-native link and react-native run-ios ...
image

image

is this repo dead?

there are some useful pr's
most important one for upgrading react native to 0.40.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.