Skip to content

This example provides a function for generating the URL of signatures required for Google Maps API web service

License

Notifications You must be signed in to change notification settings

youssman/GMUrlSigner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMUrlSigner

CI Status Version License Platform

This example provides a function for generating the URL of signatures required for Google Maps API web service (business account) calls in Objective-C projects.

The original code is available here.

I simply took the necessary code to the URL signature generation and use it in a simple way.

You can test the generated signature with this tool

Installation

CocoaPods(Recommended)

GMUrlSigner is available through CocoaPods.

  1. Add pod 'GMUrlSigner' to your Podfile.
  2. Run pod install

Manual

  1. Add all files under GMUrlSigner/GMUrlSigner to your project

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

#import "GMUrlSigner.h"

// ...

GMUrlSigner *urlSigner = [[GMUrlSigner alloc] init];
//for our example
NSString *address = @"New+York";
NSString *clientId = @"YOURCLIENTID";
NSString *privateKey = @"vNIXE0xscrmjlyV-12Nj_BvUPaw=";

NSString *URLPortionToSign = [NSString stringWithFormat:@"/maps/api/geocode/json?address=%@&sensor=true&client=%@", address, clientId];
//get the signature
NSString *signature = [urlSigner signUrl:URLPortionToSign withThisKey:privateKey];

NSString *FullSignedURL = [NSString stringWithFormat:@"https://maps.googleapis.com%@&signature=%@", URLPortionToSign, signature];

Requirements

  • ARC

(If you are having any problems, just select your project -> Build Phases -> Compile Sources, double-click the GMUrlSigner and add -fobjc-arc)

Feed back

Feel free to comment (critical, remarks, ...) the code or propose any kind of optimizations/evolutions.

Cheers ! 🍻

Links

the Google Toolbox for Mac

URL Signing Debugger

Original UrlSigner.m

Author

youssman, Twitter

License

GMUrlSigner is available under the MIT license. See the LICENSE file for more info.

About

This example provides a function for generating the URL of signatures required for Google Maps API web service

Resources

License

Stars

Watchers

Forks

Packages

No packages published