Closed Siggs2000 closed 9 years ago
I'm seeing this same error in iOS 8
error 3 is "location unknown" - https://github.com/rubymotion/BubbleWrap/blob/master/motion/location/location.rb#L21
I just downgraded to version 2.32 of rubymotion and it works like a charm. So this bug seems to be specific to 2.33. Is that the version you're on too @markrickert ?
No, i'm still getting the same error.
Here's my code:
app.info_plist['NSLocationWhenInUseUsageDescription'] = 'Helps locate points of interest near you.'
BW::Location.get_once(purpose: 'We need to use your GPS because...', authorization_type: :when_in_use) do |location|
puts location
end
I asks me for authorization after a reset of the simulator and still returns the error.
Ahh, I think I figured it out. It works with RM 2.33. You have to set both NSLocationAlwaysUsageDescription
AND NSLocationWhenInUseUsageDescription
in the rakefile in order to use :when_in_use
. I'm getting a Proper CLLocation
object back from the Bubblewrap block from my code above when adding that additional plist line to the rakefile and compiling with RM 2.33.
@markrickert that works for me too in 2.33 with both descriptions in the rake file. For both when_in_use and also requestAlwaysAuthorization.
That's kind of weird but glad it works!
Interesting, so is this the expected behavior for iOS8 in general? Good to close this issue?
I've set both NSLocationAlwaysUsageDescription
and NSLocationWhenInUseUsageDescription
in the Rakefile and I'm requesting with BW::Location.location_manager.requestAlwaysAuthorization
but when I get the position with BW::Location.get_once(purpose: 'lalala', authorization_type: :when_in_use) { |location }|
I'm still getting {:error=>3}
sometimes.
I'm using RubyMotion 2.34 with BW 1.7.1.
Any idea what's wrong?
If you look at the source, when you call get_once
, it does the request authorization for you.
@otzy007, not sure why you're still having this error. I'd recommend trying after resetting the simulator and do a rake clean:all
and report back here.
@clayallsopp I'll add some documentation about this in the readme.
@markrickert I'm doing rake clean:all and simulator reset but still 3 of 5 times it ends with error => 3 even with this simple app https://github.com/otzy007/BWLoc
Am I doing something wrong?
Welp, my application isn't working anymore either. I was getting location results but am not anymore. I even tried downgrading to RM 2.33 to no avail. I didn't change anything. grrrrrr.
And to make matters weirder, my app still works...
#rakefile
app.info_plist['NSLocationAlwaysUsageDescription'] = 'We need your location in order to show you nearby listings and agents'
app.info_plist['NSLocationWhenInUseUsageDescription'] = 'We need your location in order to show you nearby listings and agents'
#app_delegate.rb
BW::Location.location_manager.requestWhenInUseAuthorization
BW::Location.get_once(desired_accuracy: :three_kilometers) do |result|
App.alert("#{result}")
end
Have you updated to RM 3.34 today?
No. The latest version on my system is 2.33
I just randomly experienced this issue again without changing anything location related. What triggered it this time was running the simulator on iPhone 6 mode and then going back to the default iPhone 5s. It had been working on the iPhone 5s without issue. Then it worked when I ran it on IPhone 6 and when I let it default back to the iPhone 5s, location no longer worked. I quit the simulator, re-raked and it worked again.
This is on RM 2.33. I'm thinking this may be a RM / Xcode issue. I would upgrade to 2.34 but it sounds like @markrickert is having issues on that version too.
For me this issue it's happening on both RM 2.33 or 2.34. It's not just a simultator problem, it's happening on the real device(iPhone 4s and 5) too.
Well, I think it’s high time I implement the location functionality manually in my app to see if it’s a BubbleWrap or a RM bug. :'(
@markrickert you can try the Location app from the RubyMotionSamples repo. I've modified it myself to print debug messages. You can find it here: https://github.com/otzy007/RubyMotionSamples/tree/location_bug/ios/Locations
I see that from time to time, or when you change the position in the simultator it gets a kCLErrorDomain error with the code 0(kCLErrorLocationUnknown). I see from the docs that kCLErrorLocationUnknown is raised when it cannot get the location at that time. Is this a common behaviour for the iOS apps, to raise kCLErrorLocationUnknown?
I see that error 3 it's raised for too many kCLErrorLocationUnknown errors https://github.com/rubymotion/BubbleWrap/blob/master/motion/location/location.rb#L207
I just tried your sample and it seems to be working for me. I'm not too sure about the kCLErrorLocationUnknown
issue, but there's definitely a problem with BubbleWrap if the straight Cocoa implementation works, but BubbleWrap does not.
I've run that sample app a couple of times now without issue too. Plus I did rake:clean
and re built a few times on my app using bubble-wrap and experienced the errors on some builds and not others. Each time I changed nothing.
It definitely seems like a bubble-wrap bug.
Anyone have any ideas on how to get around this? I updated rm today but still experience the issue.
I saw that there is a PR regarding removing a deprecated location method. I've tested that version in my app and it actually seems to have solved this issue from what I can tell so far.
PR: https://github.com/rubymotion/BubbleWrap/pull/422
@otzy007 Can you confirm the same for you? @markrickert I see that you're reviewing that PR so I assume it's working well for you too.
@Siggs2000 I can confirm that PR #422 fixes the issue. (sorry it took me so long to test it... busy, busy!)
Gonna close this issue again. We can have further discussion on #422.
Having a little trouble getting location to work since upgrading the simulator to ios8.
I'm trying something simple from the examples:
In my rakefile, I have:
And in the app_delegate:
The alert shows: {:error=>3}
BW::Location.authorized? shows 'true'
I'm using 1.7.1 of the gem and 2.33 of Motion