Closed SamuelThomas78 closed 5 years ago
Hey @SamuelThomas78 , seems something is not set up correctly. Try clearing you platforms, removing your app from the device and then running it again.
Hello, Thanks for this fast answer, I try removing the app and relaunch it but i got same error.
This my package.jon
{
"nativescript": {
"id": "org.nativescript.***",
"tns-android": {
"version": "4.2.0"
},
"tns-ios": {
"version": "4.2.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN
My component looks like this : import { Component, OnInit } from '@angular/core'; import { TextField } from "ui/text-field"; import { MobileServiceClient } from "nativescript-azure-mobile-apps/client";
@Component({ selector: 'login', moduleId: module.id, templateUrl: './login.component.html', styleUrls: ['./login.component.scss'] }) export class LoginComponent implements OnInit {
constructor() { }
ngOnInit() { var s = MobileServiceClient.configureClientAuthAppDelegate() //var client = new MobileServiceClient("https://****.azurewebsites.net"); //var todoItemTable = client.getTable("TodoItem"); /*
If i comment the var s = MobileServiceClient.configureClientAuthAppDelegate() lign it walks If i uncommented it i got the error. I got the error on my s7 samsung connected usb device. I launch the app by clicking run into device on Nativescript SideKick I try on other device and got same error :/ Any ideas ?
The configureClientAuthAppDelegate
is ONLY for ios. For android this is a dummy empty function, and i doubt that will cause a problem, But if you are running android only then you dont need that. Also not sure where you would put that for angular based project, but i dont think in the components is a good idea. May be it should be in the main.ts
before you bootstrap the app, but not 100% sure.
Hello, Even if i try to put it in the main.ts which so like like this -> `// this import should be first in order to load some required settings (like globals and reflect-metadata) import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { AppModule } from "./app/app.module";
import { MobileServiceClient } from "nativescript-azure-mobile-apps/client"; console.log(MobileServiceClient);
platformNativeScriptDynamic().bootstrapModule(AppModule); ` I get the same error -> Error calling module function TypeError: Cannot read property 'MobileServiceAuthenticationProvider' of undefined File nativescript-azure-mobile-apps/client/client.js, line: 29, column: 141
I look into the client.js file and it is this which is undefined -> com.microsoft.windowsazure.mobileservices.authentication
If i comment: console.log(MobileServiceClient); lign -> app is running normaly ! I dont understand how i can use this library with angular. If you just create a fresh new nativescript angular app and install nativescript-azure-mobile-apps, you'll see that it does not walk. Please help !
Hello , I finaly make it work by deleting the platforms folder and delete the app on my device. Relaunching the app made it work. First time I try it did not walk I dont know why ! Anyway thank you @PeterStaev !
I just install the plugin on my nativescript Angular App by running -> tns plugin add nativescript-azure-mobile-apps But if i put in my component -> import { MobileServiceClient } from "nativescript-azure-mobile-apps/client"; var client = new MobileServiceClient("https://mymobileapp.azurewebsites.net");
I get the error -> Error calling module function TypeError: Cannot read property 'MobileServiceAuthenticationProvider' of undefined File nativescript-azure-mobile-apps/client/client.js, line: 29, column: 141
Any ideas how i could make it walk ? Should i import a module in my app.module.ts ?