离线反向地理编码iOS

时间:2013-01-05 16:30:32

标签: ios ruby

我是Ruby的新手,我发现了这个https://github.com/drodriguez/reversegeocoding,我认为这听起来很酷。所以我尝试了示例应用程序,安装了所有内容,但是当我打电话时

 thor geocoder:database

我收到此错误:

/Users/xyz/.thor/f892c2a1d732c61bbf4ebff2abb70df6:194:in `initialize': wrong number of arguments(2 for 0) (ArgumentError)

第194行显示

csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS))

和整个方法

def insert_countries(db, countries)
ids = Hash.new
country_insert = db.prepare("INSERT INTO countries (name) VALUES (:name)")
open(countries, 'rb') do |io|
  io.rewind unless io.read(3) == "\xef\xbb\xbf" # Skip UTF-8 marker
  io.readline while io.read(1) == '#' # Skip comments at the start of the file
  io.seek(-1, IO::SEEK_CUR) # Unread the last character that wasn't '#'
  csv = FasterCSV.new(io, CSV_OPTIONS.merge(COUNTRIES_CSV_OPTIONS))
  csv.each do |row|
    country_insert.execute :name => row['country']
    ids[row['ISO']] = db.last_insert_row_id
  end
end
country_insert.close

ids
end

我不知道如何解决这个问题,我希望有人可以帮我解决这个问题。

感谢。

1 个答案:

答案 0 :(得分:1)

我找到了解决方案。问题是我的Ruby版本。从1.9.x起不再支持FasterCSV,现在CSV在Ruby标准库中...在此查看以供参考https://stackoverflow.com/a/6090840/749242