import UIKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
let googleMapsApiKey = "AIzaSyDc7eBtBwvAWucUaJcI6chyc9zNhbLQFao"
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
GMSservices.provideAPIKey(googleMapsApiKey)
return true
}
}
I'm having this reoccurring issue where the GMServices error keeps on appearing, yet I have all the relevant framework etc. Any help will be greatly appreciated!
After you imported Google Maps iOS SDK, you need to have a bridge header defined, then the SDK will be recognized.
To create this bridge header, add an arbitrary Objective-C file(eg: a .m file) to your project. Xcode will prompt to ask you if to configure a bridge header for you.
Click Yes to continue.
A file ending with -Bridging-Header.h will be added to your project.
Simply add #import in the bridge header, and you are good to go!
Also, it's safe to delete that temporary Objective-C file now.
For more Information refer this link : http://dubinski.org/wpis/google-maps-sdk-with-swift-tutorial/
Add a temporary Objective-C file to your project. You may give it any name you like.
Select Yes to configure an Objective-C bridging header.
Delete the temporary Objective-C file you just created.
In the projectName-Bridging-Header.h file just created, add this line:
'#import < GoogleMaps/GoogleMaps.h >'
Edit the AppDelegate.swift file:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
GMSServices.provideAPIKey("AIza....") //iOS API key
return true
}
This happened to me just recently when I updated my cocoapods. Now I see:
Using GoogleMaps (1.10.3)
COCOAPODS: 0.39.0
The import in the bridging header, #import <GoogleMaps/GoogleMaps.h> used to work.
Now, to resolve the issue, I had to add import GoogleMaps to the Swift file that has the error.
Add these imports at the top of the file
import GoogleMaps
import GooglePlaces
Related
I want to import the firebase-database using esm import. I can only find the script version:
<script src="https://www.gstatic.com/firebasejs/7.21.0/firebase-database.js"></script>
What is the url I need for the esm module version?
Note: I do not want a "bare import", I am not using webpack etc. I need a complete url.
There is an older version available on unpkg.com but not the current version.
It turns out there are two CDN's that can provide this: snowpack/skypack, and jspm:
skypack:
import firebase from 'https://cdn.skypack.dev/#firebase/app'
import 'https://cdn.skypack.dev/#firebase/database'
jspm:
import { firebase } from 'https://jspm.dev/#firebase/app'
import 'https://jspm.dev/#firebase/database'
These both deal with "bare import" conversion to JS, and any code conversions required to be JS Modules.
Google does not appear to want to support a module form on their firebase CDN, an Issue to that effect was immediately closed, suggesting complex workflow solutions.
I'm really thankful to the two projects above, supporting simple es6 JS and zero workflow solutions.
Edit: snowpack's esinstall can turn most js files into modules. Here's a node script that brought in all my dependencies:
#!/usr/bin/env node --require esm
import { install } from 'esinstall'
import nodePolyfills from 'rollup-plugin-node-polyfills'
async function run() {
const foo = await install(
[
'mapbox-gl',
'three',
'three/examples/jsm/controls/OrbitControls.js',
'three/src/core/Object3D.js',
'chart.js',
'dat.gui',
'fflate',
'#turf/turf',
'stats.js',
'#firebase/app',
'#firebase/database',
],
{
rollup: {
plugins: [nodePolyfills()],
},
}
)
}
run()
If you're using a bundler, then follow the instructions in the documentation:
Install the firebase npm package and save it to your package.json file
by running:
npm install --save firebase
To include only specific Firebase products (like Authentication and
Cloud Firestore), import Firebase modules:
// Firebase App (the core Firebase SDK) is always required and must be listed first
import * as firebase from "firebase/app";
// If you enabled Analytics in your project, add the Firebase SDK for Analytics
import "firebase/analytics";
// Add the Firebase products that you want to use
import "firebase/auth";
import "firebase/firestore";
For realtime database, you would add import "firebase/database".
Consider the following Javascript and Flow code:
import type { $Request, $Response } from 'express';
function middleware(req: $Request, res: $Response) {}
middleware({}, {});
(full code at https://github.com/bradvogel/flow-playground)
When express isn't installed as an npm module, Flow correctly flags the code error:
However, when I npm install express, Flow can no longer resolve the types (from flow-typed):
Can someone explain who Flow is trying to import the types from the Express module, versus from flow-typed? How do I overcome this?
Flow doesn't really know about Node packages as a unit, so if you don't want Flow to try to parse things in node_modules, you'll want
[ignore]
<PROJECT_ROOT>/node_modules/.*
in your .flowconfig. If you did want to allow a subset of node_modules, the [ignore] explain how to do that.
I'm not aware of how Flow prioritizes explicitly-declared type definitions from flow-typed vs real files, but presumably given what we're seeing here, Flow must try to load type definitions from the actual imported file unless the file is ignored.
I am new to MeteorJS, and I am using Linux. As a basic newbie, I decided to stick to the tutorials on their official website. I went to follow the to-do list tutorial and selected the blaze option. At around step 6 or 7 the tutorial mentioned that you should start to see your application come together in your localhost:3000 when running it. After starting meteor and waiting for it to build the application I opened up localhost:3000. it looked like this:
AppImage. I thought there was an issue with my meteor installation so I ran
meteor npm install
to check if my installation was up to date and the output was:
up to date in 12.362s
I couldn't figure out what was wrong since the terminal wasn't sending any requests either so I opened the console in my browser and was greeted by the following errors:
Uncaught Error: Cannot find module './main.html'
at makeMissingError (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:232)
at Module.resolve (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:238)
at Module.moduleLink [as link] (modules.js?hash=20efd7567f62601be7ae21d11e21baf9bd63c715:307)
at module (main.js:1)
at fileEvaluate (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:346)
at Module.require (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:248)
at require (modules-runtime.js?hash=23fe92393aa44a7b01bb53a510a9cab5fb43037c:268)
at app.js?hash=b426fd76718daefbb34707a544746de2f90dc26c:258
Is there any way to fix this?
Thanks a lot.
edit
Some of you wanted to take a look at the main HTML and js files in the client directory, so I've included them here:
main HTML and JS:
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
import '../imports/ui/body.js';
Template.hello.onCreated(function helloOnCreated() {
// counter starts at 0
this.counter = new ReactiveVar(0);
});
Template.hello.helpers({
counter() {
return Template.instance().counter.get();
},
});
Template.hello.events({
'click button'(event, instance) {
// increment the counter when button is clicked
instance.counter.set(instance.counter.get() + 1);
},
});
<head>
<title>simple-todos</title>
</head>
How to read the stack trace:
at module (main.js:1)
In main.js on line 1 you are trying to import your main.html file.
Cannot find module './main.html'
Your main.js file likely has a statement like import './main.html'; on the first line.
This means that you must not have a main.html file adjacent to your JS file and so it cannot include it in the build.
Verify spelling, case, and location of the file (what folder it belongs in). They need to be siblings in the same folder.
I want to use Firebase with Swift 5, but error message appears.
Could not build Objective-C module 'Firebase'
I tried all resolutions on below pages, but I can't solve it:
Error: Could not build Objective-C module 'Firebase'
https://github.com/firebase/quickstart-ios/issues/672
import UIKit
import Firebase
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
return true
}
}
I expect Build Success, but actually Build Failed.
Build error messages are:
'FirebaseCore/FirebaseCore.h' file not found
Could not build Objective-C module 'Firebase'
And, xcode shows Error message at
import Firebase
in AppDelegate.swift
My business partner solves this issue.
The resolution is below steps:
Quite xcode
Delete "ProjectName.xcworkspace", "Podfile.lock" and "Pods".
Delete project's temp files located at ~/Library/Developer/Xcode/DerivedData (Command + Shift + G in finder)
Run "pod install" from terminal.
Open "ProjectName.xcworkspace".
Add "$(inherited)" to "TARGET > Build Settings > Framework Search Paths".
Pod deintegrate.
Delete xcworkspace file.
Open terminal with Rosetta.
Install pods.
I'm trying to run a typescript project (I'm using vs2012) and to import angular 2.
the projects is set to AMD module system and ECMAcript 5
In ts filed I'm importing the module:
import ng2 = require('angular2/angular2');
=> in js file it replaced to:
define(["require", "exports"], function (require, exports) {
And I'm getting this require.js runtime error:
Mismatched anonymous define() module: function (require, exports) {
....
// code
....
}
Is anyone knows what the cause of it?
Thanks a lot!
Lior
Try using the new ES6 syntax for importing files.
Example: import {bootstrap} from 'angular2/angular2';
This Angular2 Visual Studio tutorial can help you setup your project.