NativeScript / push-plugin

Contains the source code for the Push Plugin.
Apache License 2.0
123 stars 48 forks source link

Vuejs Support #214

Open lukepolo opened 6 years ago

lukepolo commented 6 years ago

Which platform(s) does your issue occur on?

IOS 11.3

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Follow the docs :

Make sure the app's id is the same as registered tns buid ios

Go to XCode, enable push : image

Make sure *. entitlements exist with image

Add :

var pushPlugin = require("nativescript-push-notifications");

Is there any code involved?

I am using the https://github.com/nativescript-vue/nativescript-vue template and just this plugin, nothing else has been added.


import Vue from 'nativescript-vue';

// This fails horribly
var pushPlugin = require("nativescript-push-notifications");

import router from './router';

import store from './store';

import './styles.scss';

// Uncommment the following to see NativeScript-Vue output logs
Vue.config.silent = false;

new Vue({

  router,

  store,

}).$start();
tbozhikov commented 6 years ago

Hi @lukepolo, as the support for Vue in NativeScript is in experimental stage we haven't implemented such compatibility in this plugin and that is why you may get this error. If you or anyone else can help solving this one, we will be happy to receive PRs.

rebz commented 6 years ago

+1 Would love to have this. I don't know enough about the iOS side to properly submit a PR.

vratojr commented 5 years ago

Hello, @lukepolo , to go one step further you should change your require to import:

import * as pushPlugin from "nativescript-push-notifications";

I'm using the vue template as well and I succeed in registering the app and receiving notifications.