Closed andersennl closed 10 years ago
Did you try to examine what result
was? ie puts result
?
& can you also try updating your BubbleWrap version? gem "bubble-wrap", "~> 1.7.0"
(I've updated the README accordingly)
I've updated the gem version. This is the output of p result
:
{:to=>#<CLLocation:0xafa95c0>, :from=>nil}
{:to=>#<CLLocation:0xab525d0>, :from=>#<CLLocation:0xa9c2de0>}
{:to=>#<CLLocation:0xaf72690>, :from=>#<CLLocation:0xaf072e0>}
{:to=>#<CLLocation:0x1f5edf10>, :from=>#<CLLocation:0x1f56af10>}
{:to=>#<CLLocation:0xc4702f0>, :from=>#<CLLocation:0xc447fc0>}
{:to=>#<CLLocation:0xab480e0>, :from=>#<CLLocation:0xab53530>}
As I just pasted the result I realize that the second CLLocation on the first line is nil. This is the problem, right? I should check if it's nil? Thanks for your help!
Update Ok, I've refactored the code a little bit. If I do it like the following it works perfectly:
p "From Lat #{result[:from].latitude}" if result[:from]
p "Long #{result[:from].longitude}" if result[:from]
p "To Lat #{result[:to].latitude}" if result[:to]
p "Long #{result[:to].longitude}" if result[:to]
Yup, exactly - from Apple's docs: "The location data from the previous update. If this is the first update event delivered by this location manager, this parameter is nil."
I've just added BubbleWrap to my project and getting the error from the title. This is my rakefile:
This is the gem version:
gem "bubble-wrap", "~> 1.5.0"
. And this is how I update the location:Here is the full error:
What am I doing wrong? Thanks!