jamesisaac / react-native-background-task

Periodic background tasks for React Native apps, cross-platform (iOS and Android), which run even when the app is closed.
MIT License
1.11k stars 110 forks source link

Cannot read property 'schedule' of undefined #53

Open prasanthyejje opened 6 years ago

prasanthyejje commented 6 years ago

i followed Your README documentation but i am getting this error. colud you help me to solve this.

Version Dependency Version : "react-native-background-task": "^0.2.1" version of RN is: 0.50.3 react-native-cli: 2.0.1 My Device : windows-7, 64-bit , 8GB RAM

jojjesv commented 6 years ago

In my case I accidentally assigned BackgroundTask.define(...) to a variable and attempted to invoke task.schedule(). Since there can only be one task then BackgroundTask.define() does not return some sort of instance. Fixed it by being sure to link it correctly and invoking BackgroundTask.schedule().