This app is no longer being supported by the Voting Information Project.
First you must install the package manager CocoaPods v0.34+ on your Mac:
http://cocoapods.org/
sudo gem install cocoapods
First, clone the repository and cd to the project root directory (the directory with this README)
Then, install the project's third party libraries via CocoaPods:
cd objc/VotingInformationProject && pod install
The project uses two plist files for configuration and they need to be copied from their template files for use. From the objc/VotingInformationProject directory, do:
cd VotingInformationProject/Resources
// Your relative path should now be:
// objc/VotingInformationProject/VotingInformationProject/Resources
cp CivicAPIKey.plist.template CivicAPIKey.plist
cp settings.plist.template settings.plist
The defaults for the settings.plist file should work, but can be configured.
See SETTINGS.md file for details.
In order to access the Google Voting Information API, you will need an API browser key.
Follow the instructions below in the section 'Updating the Civic Info API Key',
then paste the key into your CivicInfoAPIKey.plist file where indicated.
In order for the Google Directions service to work, you will need a Google Directions
API key. Acquire a Google Directions API Key using these instructions:
https://developers.google.com/maps/documentation/directions/#api_key
Then, paste the key into the GoogleDirectionsAPIKey entry in your settings.plist
In the objc/VotingInformationProject, open the project in Xcode by opening the file:
VotingInformationProject.xcworkspace
WARNING: Because the project uses CocoaPods, you must always open the project with this .xcworkspace file. The project will not build correctly if you open the project using the standard .xcproject file.
Once open in xcode, run the project and it will open in the simulator.
If the project does not build or run:
- Ensure you opened the project using the .xcworkspace file
- Ensure you copied both the settings.plist and CivicInfoAPIKey.plist files from their templates
If no data loads:
- Ensure you correctly copied your browser Civic Info API key to the proper location (between the tags) in the CivicInfoAPIKey.plist file.
Checkout the most recent version (master or develop) of the project:
git pull origin master
# or
git pull origin develop
Then, with Xcode closed, run:
cd objc/VotingInformationProject && pod install
Next, ensure your settings.plist file contains only the keys found in SETTINGS.md. If it does not, recopy the settings.plist.template file using the instructions in the build section and re-add your api keys after copying.
Now open Xcode. Run:
- Project -> Clean
- Project -> Build
Generate a tracking ID for your app here: https://www.google.com/analytics/web/?hl=en
Select new mobile application and follow the prompts. Once you have a Tracking ID (UA-XXXXXXXX-X) paste it into settings.plist as value for key GoogleAnalyticsTrackingID.
Used: http://www.delitestudio.com/app/localizable-strings-merge/
The default genstrings tool does not recursively search .m files or handle merges well.
A separate script extracts the storyboard strings using ibtool, if the storyboard has been updated since the last time the script was run. To run the script, go to:
ios7-white-label-app/objc/VotingInformationProject/VotingInformationProject/Base.lproj
and run:
./update_storyboard_strings.sh
UPDATE: Apple has a tool called AppleGlot that supports incremental updates of strings files, including storyboard files. It can be downloaded by registered apple developers from: https://developer.apple.com/downloads/index.action?name=localization
Follow the instructions in the section 'Acquiring and using an API Key' here:
https://developers.google.com/civic-information/docs/using_api
Ensure you select and generate a 'browser key'.
Login or create a google account, then go to:
https://developers.google.com/maps/documentation/ios/start#getting_the_google_maps_sdk_for_ios
Follow the instructions under the section "Obtaining an API Key"
Copy the newly generated API key and paste between the string tags for the key GoogleMapsAPIKey in settings.plist
This will update the package name that will display under the application icon on the springboard.
In objc/VotingInformationProject, open the project in Xcode by opening the file:
VotingInformationProject.xcworkspace
In VointingInformationProject/Supporting Files Open:
VotingInformationProject-Info.plist
For the key 'Bundle display name' change the value '$(PRODUCT_NAME)' to the string of your choice
Save and compile the application to see the changes
Due to the data from the Google Civic API changing frequently, it is beneficial to model responses to allow for uninterrupted development.
This step is completely optional. If no spotlight API key is present the normal Google Civic API will be used instead
Stoplight is a service that allows you to capture responses and it will generate the model based on the actual response.
###Create the service
Create a Stoplight account at https://designer.stoplight.io/register
Create a new workspace 'Pew'
Create an API repo; name: VIP, initial protocol + host: https://www.googleapis.com, initial base path: /civicinfo/v2
Add an endpoint; Name: Voter Information, HTTP Method: GET, Path: /voterinfo
Authentication; API Key, add the key you obtained from 'Updating the Civic Info API Key'
###Add some data
Under 'Responses' select "Add +"
Select the 'Example' tab and paste in a JSON response
Click 'Generate definition from example'
Click 'Save endpoint'
Select 'Mocking' and pick the endpoint you created to activate
You can create as many endpoints as you need and choose to mock with them or not mock at all and simply pass the request through to the actual API.
Example test data is located at: VotingInformationProject/Resources/Stoplight/test_response.json
The VIP App uses:
- MagicalRecord: MIT License
- AFNetworking: MIT License