24 Nov 2011, 8:56pm
/dev/obj-c
by

leave a comment

iOS Simulator and “Couldn’t register” error

As far as I can tell, if you get this error when trying to run your app in the iOS simulator:

Couldn't register com.greenpointware.Konk-iOS with the bootstrap server. Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.

the only course of action is to restart your machine. I’m sure there’s a process hung in the background that’s preventing it from working, as this line from the internets seems to suggest:

kill -9 `ps ax | grep Simulator | grep -v grep | awk '{print $1}'`

but that didn’t work for me. Rebooting did.

22 Nov 2011, 12:01pm
/dev/random /dev/ruby
by

leave a comment

Stubbing Geocode with FactoryGirl

Google doesn’t seem to like it when our geocoded models hammer their geocoding API during our test runs so we should stub out the geocoding call. To do so:

FactoryGirl.define do
  factory :place do
    name         { Randgen.name }
    kind         'city'
    timezone     'Mountain Time (US & Canada)'
    enabled      true

    after_build  { |place| place.stub!( :geocode ).and_return( [1,1] ) }
    after_create { |place| place.stub!( :geocode ).and_return( [1,1] ) }
  end
end