You can use google map in your native ios application (Objective- C only) even internet connection will not available inside your device.This ppt will help you to do same.
2. POD SETUP
• 1) Open terminal
• 2) sudo gem install cocoapods (gem will get installed in Ruby inside
System library) or Try on 10.11 Mac OSX El Caption sudo gem install -
n /usr/local/bin cocoapods
• 3) pod setup
• 4) create a xcode project
• 5) cd "path to your project root directory"
• 6) pod init
• 7) open -a Xcode Podfile (podfile will get open in text mode. Initially
it will be empty put the following line of code.)
• 8) pod 'AFNetworking', '0.9.1’
(It’s finally time to add your first dependency using CocoaPods! Copy
and paste the following into your pod file, right after target
"AFNetworkingProject" do:)
3. Google Account Setup
• Go to the Google Developers Console.
• Create or select a project.
• Click Continue to enable the Google Maps SDK for iOS API.
Optionally, you can also enable the Google Places API for iOS now.
Alternatively, you can enable the Google Places API for iOS later, if
you need it.
• On the Credentials page, get an iOS key and set the API credentials.
Note: If you have an existing iOS key, you may use that key. You can
use the same key with any of your iOS applications within the same
project.
• Enter your app's bundle identifier when prompted. For example:
com.example.hellomap.
• Click Create.
• Your new iOS key appears in the list of API keys for your project. An
API key is a string of characters, something like this:
• AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0
6. API Key Setup in IOS Project
Add your API key to your AppDelegate.m as follows:
• Add the following import statement:
@import GoogleMaps;
• Add the following to your
application:didFinishLaunchingWithOptions: method,
replacing YOUR_API_KEY with your API key:
• [GMSServices provideAPIKey:@"YOUR_API_KEY"];
7. Basic Code
• #import "YourViewController.h"
@import GoogleMaps;
@implementation YourViewController {
GMSMapView *mapView_;
}
- (void)viewDidLoad {
// Create a GMSCameraPosition that tells the map to display the
// coordinate -33.86,151.20 at zoom level 6.
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
}
@end