Skip to content

Instantly share code, notes, and snippets.

@jacklynrose
Last active January 1, 2016 09:09
Show Gist options
  • Save jacklynrose/8123412 to your computer and use it in GitHub Desktop.
Save jacklynrose/8123412 to your computer and use it in GitHub Desktop.
Bootstrapping your app for working with frank and location services and the frank step to turn location services for your app on and off
BW::Location.get_once do |result|
# this is just to bootstrap
end
require 'osx/plist'
Given(/^location services are turned (on|off)$/) do |location_switch|
quit_simulator
sleep 10 # wait for simulator to quit - unfortunate
key = 'com.yourcompany.FMLL'
sdk = '7.0'
location_clients_plist = "#{ENV['HOME']}/Library/Application Support/iPhone Simulator/#{sdk}/Library/Caches/locationd/clients.plist"
clients_list, format = OSX::PropertyList.load_file(location_clients_plist, true)
puts clients_list.inspect
clients_list[key]['Authorized'] = (location_switch == 'on' ? true : false)
puts clients_list.inspect
OSX::PropertyList.dump_file(location_clients_plist, clients_list, format)
end

This assumes you're using bubble-wrap

  1. Put osx-plist in your Gemfile
  2. Put the code from bootstrap.rb gist into your AppDelegate's application:didFinishLaunchingWithOptions: method
  3. Run rake
  4. Press either "OK" or "Don't Allow"
  5. Exit the app via terminal
  6. Delete the code from bootstrap.rb
  7. You're now ready to use step, create features/step_definitions/location_services_steps.rb
  8. Paste in the code from location_services_steps.rb in this gist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment