2

I'm working on a phonegap project. I initialized OneSignal in my app.js file according to the documentation. But when I start my app, it gives Uncaught ReferenceError: OneSignal is not defined. I'm not so much familiar with phoegap and onesignal. If you need further explanation, please comment. Thank you

Choxmi
  • 1,584
  • 4
  • 29
  • 47

2 Answers2

1

For PhoneGap the OneSignal code should be added to your first page. Most of the time this index.js. Adding it to the app.js file is for Intel XDK and Ionic. 2. Add required code.

It is possible the OneSignal plugin did not get fully added, check the logcat (Android) or the Xcode device log (iOS) for errors before the one you noted above.

Lastly you can try a Clean Build.

jkasten
  • 3,899
  • 3
  • 32
  • 51
  • I have added my code to the app.js file which is the first page. But still I get the same error. :( – Choxmi Apr 18 '16 at 06:52
  • Looks like you solved the issue by removing a duplicated entry in your config.xml? http://stackoverflow.com/questions/36687064/uncaught-typeerror-cannot-read-property-onesignal-of-undefined-source-file/36690035#comment60964586_36687064 – jkasten Apr 18 '16 at 23:52
0

I found my uBlockOrigin chrome extension was blocking it. Not sure what to do to fix it but yeah. Give that a check.

MomasVII
  • 4,641
  • 5
  • 35
  • 52