darylrowland / react-native-remote-push

React Native Remote Push Notifications Component
MIT License
158 stars 29 forks source link

RemotePushManager is undefined #2

Closed lazywei closed 9 years ago

lazywei commented 9 years ago
 URL: file:///private/var/mobile/Containers/Bundle/Application/AA9C238D-D83B-4D09-928B-4C5194A9A32C/CmMobile.app/main.jsbundle
 line: 41484
 message: undefined is not an object (evaluating 'RemotePushManager.requestPermissions')"

Hi, I got this when trying to use this with React Native 0.4.4

MossP commented 9 years ago

Did you get any luck with this error? I've just run into it too.

lazywei commented 9 years ago

@MossP React Native's built-in support for push notification has been improved a lot. I'd suggest you just use that one.

jterskine commented 9 years ago

Ran into this myself. Most likely due to this line in RemotePushIOS.js:

var RemotePushManager = require("NativeModules").RemotePushManager;

RemotePushManager is not being found.

Resolved by add following files in Xcode (in the same directory where AppDelegate.m is found) and adding the files in your iOS folder:

RCTRemotePushManage.h
RCTRemotePushManage.m
RemotePushDelegate.h
RemotePushDelegate.m

Then following the steps outlined in the Getting Started.

MossP commented 9 years ago

That was it, thank you. As I had installed via npm I hadn't needed to copy all the files across to the app so only included RemotePushDelegate.h and RemotePushDelegate.m, including RCTRemotePushManage.h and RCTRemotePushManage.m fixed it, I didn't need to move the files around, I just had to include in project from the node_modules folder.

Thank you @jterskine

I might have a look at the integrated one soon @lazywei Can you successfully grab remote tokens with it now?