Giter Club home page Giter Club logo

Comments (12)

ravindrakw avatar ravindrakw commented on May 18, 2024 2

I have done something like this

GMSServiceKey.d.ts

declare function GMSServiceKey(): void; export = GMSServiceKey;

GMSServiceKey.js

module.exports = function () { GMSServices.provideAPIKey("YOUR KEY"); };

in app.component.ts

import GMSServiceKey = require('./GMSServiceKey');

and

if (application.ios) { GMSServiceKey(); }

from nativescript-google-maps-sdk.

poorcoder avatar poorcoder commented on May 18, 2024

I can not say for the error but. You just simply create a js file on app folder lik app/app.js and put this code...

"use strict";
var application = require("application");
if(application.ios) {
  GMSServices.provideAPIKey("PUT_API_KEY_HERE");
}
application.start({ moduleName: "pages/home/home" });

from nativescript-google-maps-sdk.

skdeepak88 avatar skdeepak88 commented on May 18, 2024

I dont think we use the above JS file for Angular 2 version of Nativescript. We require/import nativescript-angular/application instead of application. When I use the above code I get the error Cannot find name 'GMSServices'.

from nativescript-google-maps-sdk.

dapriett avatar dapriett commented on May 18, 2024

Usually when you can't find GMSServices, that means the iOS Google Maps pod didn't get installed. Make sure you have cocoapods installed.

from nativescript-google-maps-sdk.

thinkoverit avatar thinkoverit commented on May 18, 2024

Actually this is first error when build is started, without this line
build succeeds with google map cocoapods installed properly and When app is
run it gives exception too that API key shall be set.
On May 31, 2016 6:32 PM, "dapriett" [email protected] wrote:

Usually when you can't find GMSServices, that means the iOS Google Maps
pod didn't get installed. Make sure you have cocoapods
https://guides.cocoapods.org/using/getting-started.html#getting-started
installed.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#31 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABwtdm1OHeWJ7QdOfcdVu06wYLoDXd9sks5qHDFcgaJpZM4ImcTs
.

from nativescript-google-maps-sdk.

skdeepak88 avatar skdeepak88 commented on May 18, 2024

I have installed cocoapods. See below:

$ gem which cocoapods
 /Users/deepak/.gem/ruby/2.0.0/gems/cocoapods-1.0.0/lib/cocoapods.rb

from nativescript-google-maps-sdk.

ravindrakw avatar ravindrakw commented on May 18, 2024

Faced same issue.
Newbie to Angular and Typescript, so not sure where the issue is but as workaround exported GMSServices in JS module and added definition file "d.ts". My 2 cents that there is a issue in typings.

Could you please suggest a better solution. Thanks.

from nativescript-google-maps-sdk.

skdeepak88 avatar skdeepak88 commented on May 18, 2024

@ravindrakw Can you share the code snippet that worked for you. Just the bits you where talking about above. Thanks :)

from nativescript-google-maps-sdk.

leocaseiro avatar leocaseiro commented on May 18, 2024

I also realised we need to register the Element in PascalCase MapView instead of camelCase mapView:

registerElement("MapView", () => require("nativescript-google-maps-sdk").MapView);

from nativescript-google-maps-sdk.

dapriett avatar dapriett commented on May 18, 2024

Here's a stackoverflow reference, in case anyone else is having issues: http://stackoverflow.com/questions/36443476/wiring-up-google-maps-nativescript-plugin-with-angular-2

from nativescript-google-maps-sdk.

viniciodeltoro avatar viniciodeltoro commented on May 18, 2024

I did the steps ravindrakw mentioned and that fixed my issue. Thank you guys

from nativescript-google-maps-sdk.

dxshindeo avatar dxshindeo commented on May 18, 2024

Even simpler - in your main.ts file, add

import * as platform from "platform";
declare var GMSServices: any;

// before calling .boostrap
if( platform.isIOS ) {
    GMSServices.provideAPIKey("YOUR KEY");
}

from nativescript-google-maps-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.