gregwilson / react-native-apple-healthkit Goto Github PK
View Code? Open in Web Editor NEWA React Native bridge module for interacting with Apple HealthKit data
A React Native bridge module for interacting with Apple HealthKit data
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
The dependency in the package seem to be locked to 0.28, is this a hard limit, or have the dependency just not been updated?
├── UNMET PEER DEPENDENCY [email protected]
└── [email protected]
npm WARN [email protected] requires a peer of react-native@^0.28.0 but none was installed.
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 :)
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 :)
When I'm importing 'react-native-apple-healthkit' only the param Constants is available, I'm doing something wrong?
HKQuantityTypeIdentifierAppleExerciseTime is only available on iOS 9.3+. The requirement creates instacrash on iOS 9.1 or lower. Any way we can only conditionally require this HKObjectType if the OS is 9.3 or above?
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:
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.
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)
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.
Can we publish the fix for RN v0.40 to npm?
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!
I try to use it with react-native. When I import it then it gives this error and "undefined is not a function" on compilation.
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?
Any ideas on how to run background tasks with this library?
Spec would be to run a GET request in the background for number of steps they've taken if phone is unlocked. App would run in background and GET data from HealthKit and then POST to DB.
Something along the lines of this request (read the comments under the accepted answer)
http://stackoverflow.com/questions/30361033/healthkit-data-inaccessible-in-background
I'am informining myself about CDA at the moment and how to integrate read that document from an ios application.
Since Apple has anounced to integrate the CDA standard, will there be any chance that you integrate CDA into your module.
Ref:
https://developer.apple.com/reference/healthkit/hkcdadocument
I found that when I manually enter the number of steps, the return of the parameters are manually entered value, can filter the user manually enter the number of steps?
Hello,
Any ideas on integrating ios10 meditation to this project? Thanks!
Do you have a method to delete an object after it has been saved?
deleteObjects(of:predicate:withCompletion:)
https://developer.apple.com/reference/healthkit/hkhealthstore/1614162-deleteobjects
I would like to use AppleExersiseTime in my app but there does not seem to be full support for it yet.
Thanks!
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.
How can I get the calories burnt data from the apple watch Healthkit in react native?
Hello,
I followed the installation instructions verbatim and still encounter the aforementioned error. Any idea what I may be doing incorrectly?
there are some useful pr's
most important one for upgrading react native to 0.40.0
Does the android device support this component?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.