9

Yesterday I recived an email from google saying that I could acces to the map api for ios, I generated my key from the app console and I follow the steps of https://developers.google.com/maps/documentation/ios/start but xcode throw this error.

#import <GoogleMaps/GoogleMaps.h> //file not found

Thanks for your support.

It is normal that appears the Headers executable instead of the folder?

enter image description here

SOLVED!

ƒernando Valle
  • 3,634
  • 6
  • 36
  • 58

12 Answers12

20

1) Extract the subfolder A in version and I renamed it to GoogleMaps.framework

2) Copy this folder to your project folder.

enter image description here

3) Add it to your Frameworks group in the project

enter image description here

4) Import to AppDelegate as #import "GoogleMaps/GoogleMaps.h"

אורי orihpt
  • 2,358
  • 2
  • 16
  • 41
ƒernando Valle
  • 3,634
  • 6
  • 36
  • 58
  • 1
    Did you unzip the SDK with something which doesn't understand symbolic links? Or maybe unzip it on a PC and then copy the folder to your Mac? GoogleMaps.framework/Headers is a symbolic link to GoogleMaps.framework/Versions/A/Headers. When I unzip on my Mac the symbolic link is set up correctly. But when I unzip on my PC instead of symbolic links I get text files which just contain the path (eg 'Versions/Current/Headers'). This would probably cause the kind of error you're seeing. – Saxon Druce Mar 02 '13 at 08:13
  • I dowloaded from a pc but I extracted it in my Mac – ƒernando Valle Mar 06 '13 at 07:25
  • Ok now I checked it and this was my error, thanks, modify to an answer to set it as the correct answer. – ƒernando Valle Mar 06 '13 at 07:42
  • Hi Fernando, no worries :) I posted it as a separate answer. – Saxon Druce Mar 06 '13 at 12:00
  • 1
    It's only a temporary solution. When I reopen the project the problem persists and I have to do everything again to make it work. @ƒernando Valle – zbz.lvlv Oct 05 '14 at 01:24
11

Make sure you unzip the SDK with something which understands symbolic links.

GoogleMaps.framework/Headers is a symbolic link to GoogleMaps.framework/Versions/A/Headers.

When I unzip it on my Mac the symbolic link is set up correctly. But when I unzip it on my PC instead of symbolic links I get text files which just contain the path (eg Versions/Current/Headers).

If you unzip on a PC and then copy the folder to your Mac (or unzip using some other method which doesn't create symbolic links), then you will get the error you see.

Saxon Druce
  • 17,406
  • 5
  • 50
  • 71
  • In my case the missing symbolic link was coming from cordova framework. So I resolved by removing/adding the relative plugin with cordova on Mac: `cordova plugin remove ...` and `cordova plugin add ...` – Mariano Paniga Nov 11 '15 at 14:13
8

Try this:

Drag the GoogleMaps.framework bundle to the Frameworks group of your project. When prompted, select Copy items into destination group's folder.

You have to copy the unzipped folder "GoogleMaps.framework" into XCode.

Then follow steps 3 & 4

3.Right-click GoogleMaps.framework in your project, and select Show In Finder.

4.Drag the GoogleMaps.bundle from the Resources folder to your project. We suggest putting it in the Frameworks group. When prompted, ensure Copy items into destination group's folder is not selected.

If still not working try adding manually GoogleMaps.framework in the Build Phases tab->Link Binary with Libraries

Nicolas Tonneau
  • 596
  • 4
  • 17
PGLongo
  • 439
  • 4
  • 13
  • It does not work, I follow every step as you said and appear the same problem. I tried to link the library too butothing happen. What should appear in GoogleMaps.framework? when I import in Frameworks it only show me "Headers" (file not folder) may be it is the problem. – ƒernando Valle Feb 26 '13 at 07:25
  • You should have the GoogleMaps.framework (which contain Headers) and GoogleMaps.bundle. – PGLongo Feb 26 '13 at 07:42
3

Here's the first few steps you need:

  • Download GoogleMaps-iOS-1.1.0.zip from their site
  • Unzip the file. You now have a GoogleMaps-iOS-1.1.0 folder
  • In that folder you have a GoogleMaps.framework folder.
  • Copy or move the GoogleMaps.framework folder to inside your project folder (in Finder).
  • Drag the GoogleMaps.framework folder onto your Frameworks group in Xcode.
  • In the options sheet, uncheck "Copy items into destination group's folder". Make sure your target is checked in "Add to targets". Click OK.
  • (Note that you can also do this the other way, by not copying it into your project folder and checking "Copy items into destination group's folder". Xcode will copy the folder itself.)

  • Import using #import "GoogleMaps/GoogleMaps.h". The angle bracket usually work too, but in this case it should use quotes.

You should end up with a golden toolbox icon:

enter image description here

Using an #import with angle brackets should search the system frameworks, then inside your project folder, but to be safe try it with quotes.

nevan king
  • 112,709
  • 45
  • 203
  • 241
  • It does not work, I follow every step as you said and appear the same problem. What should appear in GoogleMaps.framework? when I import in Frameworks it only show me "Headers" (file not folder) may be it is the problem. – ƒernando Valle Feb 26 '13 at 07:24
  • If you copy the "Headers" folder to Xcode, you will get a group called "Headers", which looks like a folder. If you copy the "GoogleMaps.framework" folder, you should get a (gold toolbox) frameworks icon. Are you sure you're copying the right folder? My advice would be to start from the beginning (downloading the zip file) and use a new project to see which step isn't working. – nevan king Feb 26 '13 at 10:20
  • Yes, when I copy GoogleMaps.framework folder it appears like a "tools box" in xcode. I tried start with new proyect several times, downloading the zip and following every step. The thing that I dont see good is when I copy it only appear Headers executable file instead of the folder with all the headers like in the other frameworks. I will edit the post adding an image for show you how it appears. – ƒernando Valle Feb 26 '13 at 10:28
  • That's very strange. It could be that there's something wrong with linked files on you computer. You could try starting from the sample project in the "GoogleMapsSDKDemos" folder. If that works, transfer your project over to it. Check if the headers appears correctly in that project. – nevan king Feb 26 '13 at 11:23
1

the GoogleMaps framework is probably not in the Library folder but in the same directory like all other project files. I this case you have to write #import "GoogleMaps/GoogleMaps.h or #import "GoogleMaps.h"

Areal-17
  • 406
  • 3
  • 10
1

I've been struggling with this issue for hours; I'm using CocoaPods, Swift and Xcode 6.1.1. I followed all the steps for including GoogleMaps in my project carefully, tried many different things like removing symbolic links in the downloaded package or manually linking the binaries in build phases or trying #include "GoogleMaps.h", #include "GoogleMaps/GoogleMaps.h" and "#include <GoogleMaps/GoogleMaps.h> in my bridge file, none of that worked... Finally used CocoaPods instead of including the framework myself and it worked! Hope it helps someone out there:

In the Podfile:

pod 'Google-Maps-iOS-SDK', '~> 1.9.2'

And in your Bridge file:

#import "GoogleMaps.h"

Soheil Jadidian
  • 878
  • 7
  • 12
0

make sure you upgrade to the latest sdk. v1 and v3 were different. had trouble getting v1 to work

brian.clear
  • 5,277
  • 2
  • 41
  • 62
0

Maybe you've forgot after change Podfile, you have to run

pod update

then rerun react-native run-ios

ManhNguyen
  • 121
  • 1
  • 5
0

Its better install Pod for google map, Just add google maps into pod. Note if you don't have pod file in your project folder ios/ then do below steps pod init

the add below code in your pod file

platform :ios, '9.0'

target 'YourAppTarget' do
  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS
end
# pre_install do |installer|
   # copied from https://github.com/CocoaPods/CocoaPods/issues/2926
   # workaround for https://github.com/CocoaPods/CocoaPods/issues/3289
  #  def installer.verify_no_static_framework_transitive_dependencies; end
# end

target 'YourAppTarget-tvOS' do

end

Do not forget to add AirGoogleMaps to your project directory from node_modules/react-native-maps/lib/ios

Sadanand
  • 1,080
  • 3
  • 13
  • 30
0
#import <GoogleMaps/GoogleMaps.h>

add above the RCT_NEW_ARCH_ENABLED or Debug in the Appdelegate.m

then add +

[GMSServices provideAPIKey:@"IOS_GOOGLE_MAPS_API_KEY"];

then add the Below Lines into podfile above the use_native_modules!

rn_maps_path = '../node_modules/react-native-maps'
pod 'react-native-google-maps', :path => rn_maps_path

This will work

0

Add these lines to your pod file

rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path

pod 'GoogleSignIn', '~> 6.1.0'

after that run pod install

-2

This answer will also might help you. The above all answers are not worked for me at last after a long time i found like this

# import "GoogleMapsM4B/GoogleMaps.h"

Use like this it definitely solves your problem

iSekhar
  • 119
  • 1
  • 8
  • GoogleMapsM4B is for premium users (as clearly indicated in installation guides in Google Maps SDK fro IOS) – Farid Feb 03 '19 at 18:31