【问题标题】:Rubymotion / Simple geolocation with bubblewrapRubymotion /使用bubblewrap的简单地理定位
【发布时间】:2014-03-19 04:43:44
【问题描述】:

很惊讶得到以下错误:

undefined method `[]' for #<CLLocation:0x9a95cd0> (NoMethodError)

在尝试重现给出的最简单示例时:

  BW::Location.get_once do |result|
    p "From Lat #{result[:from].latitude}, Long #{result[:from].longitude}"
    p "To Lat #{result[:to].latitude}, Long #{result[:to].longitude}"
  end

CLLocation 是使用以下方法导入的(即使不确定在使用 bubbblewrap 时是否需要它):

app.frameworks += ["CoreLocation"]

因为气泡包装的位置是:

require 'bubble-wrap/location'

感谢任何显而易见的事情(:

【问题讨论】:

    标签: geolocation rubymotion


    【解决方案1】:

    BW::Location.get_once 产生一个CLLocation 对象,而不是CLLocation 的数组。

    试试这样的:

    BW::Location.get_once do |location|
        p "Lat #{location.latitude}, Long #{location.longitude}"
    end
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-04
    相关资源
    最近更新 更多