Available thru | Cocoapods |
---|---|
Latest | 0.1.0 |
Homepage | https://github.com/youssman/GMUrlSigner |
License | MIT |
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.
- Add
pod 'GMUrlSigner'
to your Podfile. - Run
pod install
Manual
- 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 ! :beers:
Links
Author
youssman, Twitter
License
GMUrlSigner is available under the MIT license. See the LICENSE file for more info.
Latest podspec
{ "name": "GMUrlSigner", "version": "0.1.0", "summary": "This example provides a function for generating the URL of signatures required for Google Maps API web service", "description": "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.nnThe original code is available [here](http://gmaps-samples.googlecode.com/svn/trunk/urlsigning/urlsigner.m).nnI simply took the necessary code to the URL signature generation and use it in a simple way.nnYou can test the generated signature with this [tool](https://m4b-url-signer.appspot.com/)n", "homepage": "https://github.com/youssman/GMUrlSigner", "license": "MIT", "authors": { "youssman": "[email protected]" }, "source": { "git": "https://github.com/youssman/GMUrlSigner.git", "tag": "0.1.0" }, "social_media_url": "https://twitter.com/YHaiti", "platforms": { "ios": "6.0" }, "requires_arc": true, "source_files": "Pod/Classes/**/*", "resource_bundles": { "GMUrlSigner": [ "Pod/Assets/*.png" ] } }