rubymotion-community / BubbleWrap

Cocoa wrappers and helpers for RubyMotion (Ruby for iOS and OS X) - Making Cocoa APIs more Ruby like, one API at a time. Fork away and send your pull requests
Other
1.18k stars 208 forks source link

Can't get the location #449

Closed GCorbel closed 9 years ago

GCorbel commented 9 years ago

In app_delegator.rb, I just copied and pasted the example code for location :

BW::Location.get(purpose: 'We need to use your GPS because...') do |result|
  p "From Lat #{result[:from].latitude}, Long #{result[:from].longitude}"
  p "To Lat #{result[:to].latitude}, Long #{result[:to].longitude}"
end

I added bubble-wrap to the Gemfile and I required bubble-wrap/location.

It just do nothing. When I do BW::Location.enabled? it returns true.

Did I miss something?

markrickert commented 9 years ago

Perhaps this? https://github.com/rubymotion/BubbleWrap#ios-8-location-requirements

GCorbel commented 9 years ago

Thanks for the very fast anwser (just a minute). It seems to be better but I have the result {:error=>3}. It is probably not related to BubbleWrap.

markrickert commented 9 years ago

We've been having some issues with location and i'm going to be working on fixing them soon. but for now can you try pointing your project at @cognitiveflux's branch?

gem 'bubble-wrap', github: 'cognitiveflux/BubbleWrap', branch: 'Fix_Location_KCLErrorLocationUnknown_restart'

And let me know if that fixes the error?

Also, note that the ios simulator is picky about locations... sometimes you have to turn the location OFF, then back on again in the simulator's debug menu or you'll get an error.

GCorbel commented 9 years ago

No, I didn't solve the bug.

GCorbel commented 9 years ago

It works now. I don't really now what I did.

I tried to do

BW::Location.get.startUpdatingLocation
BW::Location.get.stopUpdatingLocation

And I changed the position in the Simulator settings. It strange because I tried this before without success. Now, it works.

Thanks for your fast help !

markrickert commented 9 years ago

Yeah, changing the position sometimes will reset the location's internals.... Apple really needs to fix this.

Glad you got it working!

Was it with the fork i told you to try or with the main bubblewrap repos?

GCorbel commented 9 years ago

Yes, it works with the master branch. I rebooted the mac to be sure... And I already try to change the position in the emulator. It's stange...

Thanks again.