Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contacts plugin - Can't create after update. #10900

Closed
Klerith opened this issue Mar 23, 2017 · 4 comments
Closed

Contacts plugin - Can't create after update. #10900

Klerith opened this issue Mar 23, 2017 · 4 comments

Comments

@Klerith
Copy link

Klerith commented Mar 23, 2017

Ionic version:
[ ] 1.x
[ X ] 2.x

I'm submitting a ...
[ X ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
After the new change of moving 'ionic-native' to '@ionic-native/contacts', this plugin doesn't work or maybe I am missing something here ( I was using the previous version with no problems )

When I try to execute this line on runtime
let contact: Contact = this.contacts.create();

I get this error, that basically, saids I can't call create of undefined.
image

Expected behavior:
Create a contact object with no issues.

Steps to reproduce:
Just follow the ionic Contacts tutorial

http://ionicframework.com/docs/v2/native/contacts/

Related code:

This is my app.module

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    GuardadosPage,
    MapaPage,
    TabsPage
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    AgmCoreModule.forRoot({
      apiKey: 'XXXXXXXXXX'
    })
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    GuardadosPage,
    MapaPage,
    TabsPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    BarcodeScanner,
    InAppBrowser,
    Contacts,
    HistorialService,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

Also in my service, I am injecting the "Contacts" module.

I am kind of lost here.

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1
ios-sim version: 5.0.13

OS: macOS Sierra
Node Version: v6.9.5
Xcode version: Xcode 8.2.1 Build version 8C1002

@rapropos
Copy link
Contributor

Should probably be reassigned to ionic-native, but I suspect the problem is failure to adjust to the new injectable syntax:

OLD:

import {Plugin} from "ionic-native";

constructor() {
  Plugin.frobulate();
}

NEW:

import {Plugin} from "@ionic-native/plugin";

constructor(plugin: Plugin) {
  plugin.frobulate();
}

@Klerith
Copy link
Author

Klerith commented Mar 24, 2017

I use the new syntax version using '@ionic-native/contacts'

But after running some test here, looks like it works on devices, but in the browsers crashes with that error.

@jgw96
Copy link
Contributor

jgw96 commented Mar 24, 2017

This issue was moved to danielsogl/awesome-cordova-plugins#1250

@jgw96 jgw96 closed this as completed Mar 24, 2017
@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants