Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated CLLocationManagerDelegate method for locationManager:didUpdateLocations #422

Conversation

cognitiveflux
Copy link
Contributor

Updated CLLocationManagerDelegate methods for locationManager:didUpdateLocations

*Changed locationManager:didUpdateToLocation:fromLocation to locationManager:didUpdateLocations
*Preserved callback result[:from] key-value by storing previous location in an instance variable
*Added result[:previous] to include additional locations returned by the delegate method
*Updated inline documentation for location.rb
*Updated spec BW::Location
*Updated README.md with information about 'result[:previous]' value

Updated RSpec tests passed, tested on iOS Simulator 8.0 (iPhone 6) and iPhone 4S (iOS 8.0.2) device, compiled with RubyMotion 2.34.

@markrickert
Copy link
Collaborator

I hate it when Travis fails and you look at the log and see zero errors and exit status: 0. 😒

Re-running the build.

@markrickert
Copy link
Collaborator

It looks like the failure is actually nothing related to this PR... The command "bundle exec rake spec" exited with 2. It's the UIActionSheet that's causing the issue. I'll try and sort it out in the main BW repo.

@markrickert
Copy link
Collaborator

Sorry it took me so long to check this out... this fixes my problem!

I also tested it in iOS 7 and it appears to be working just fine when built with the iOS 8.1 SDK.

Can you rebase master into your branch so all other tests pass (there were some issues with UIAlertView tests in iOS 8 that I fixed in master).

Then we'll get this merged asap and release a new version.

Thanks so much for doing the legwork on this, @cognitiveflux!

@otzy007
Copy link

otzy007 commented Oct 9, 2014

Looks OK. It's always starting with a position and on the iPhone 4S(8.0.2) it works flawless.
Only on the simulator I get {:error => 3} when I change the location, for example from City Run to Apple and then back to City Run.

@markrickert
Copy link
Collaborator

Reset the simulator, quit it and then rake clean:all && bundle install && rake pod:install && rake and see if that fixes the issue in the sim. My new gem might help you with this :) https://github.com/MohawkApps/reset-sim

Glad to get some more confirmation here that this is working!

@otzy007
Copy link

otzy007 commented Oct 9, 2014

@markrickert yeah. I did all of that...

{:to=>#<CLLocation:0x11cb0b90>, :from=>#<CLLocation:0x11ee7fe0>, :previous=>[]}
{:to=>#<CLLocation:0x18e03560>, :from=>#<CLLocation:0x11cb0b90>, :previous=>[]}
{:error=>3}

@markrickert
Copy link
Collaborator

But that just happens when you manually change your location in the debug menu of the sim, correct?

@cognitiveflux
Copy link
Contributor Author

No idea why the build is failing on Travis again, no changes to the branch other than a rebase ...

@otzy007
Copy link

otzy007 commented Oct 9, 2014

@markrickert Yes. It's happening when I change the location in the simulator(Xcode 6.0.1)

@markrickert
Copy link
Collaborator

Travis is a fickle mistress. I'll reinit another build on this branch.

@cognitiveflux
Copy link
Contributor Author

Looking at the commit history and trying to keep it clean, not sure if you want me to create a new branch and resubmit a pull request, let me know

@markrickert
Copy link
Collaborator

I'm OK leaving as is... we all personally have a sordid past of things we'd rather forget... why not BubbleWrap too!!? 😁

@otzy007
Copy link

otzy007 commented Oct 9, 2014

@cognitiveflux you can rebase HEAD~6 -i and instead of pick for the last 5 you put "f". This way it will make a single commit.

@cognitiveflux
Copy link
Contributor Author

@otzy007 pretty sure I figured out why you're getting that error, let me guess, you're using significant change tracking? Actually surprised this hasn't been reported more, these lines only restart immediate location tracking, they don't restart significant change tracking, I'll make the change and add it to this pull request

@markrickert
Copy link
Collaborator

Yeah, I don’t think this will be an issue since it seems to work just fine on the device… the only time the app would stop tracking and return an error would be if the user turned off their phone, went a long distance, then turned it back on. In which case, your app wouldn’t likely be active anymore anyways.

@cognitiveflux cognitiveflux force-pushed the CLLocationManagerDelegate_didUpdateLocations branch from d0c2a39 to 388f201 Compare October 9, 2014 19:43
*Changed locationManager:didUpdateToLocation:fromLocation to locationManager:didUpdateLocations.
*Preserved callback result[:from] key-value by storing previous location in an instance variable.
*Added result[:previous] to include additional locations returned by the delegate method.
*Updated inline documentation for location.rb
*Updated spec BW::Location
@cognitiveflux cognitiveflux force-pushed the CLLocationManagerDelegate_didUpdateLocations branch from 388f201 to 0a89cf3 Compare October 9, 2014 19:47
@cognitiveflux
Copy link
Contributor Author

I'll create a separate pull request for the restart patch since it has nothing to do with the location services deprecated method. Local tests are failing on a test nothing related to location services:

.window
  - returns UIApplication.sharedApplication.keyWindow [FAILED - UIWindow.==(UIView) failed]

@markrickert
Copy link
Collaborator

Re the failure - are you running xcode 6.0.1 and ios 8.1? Apple did some weird things with the way alertviews work in ios 8.

@cognitiveflux
Copy link
Contributor Author

I am, however Travis is failing with the same one, looks like it's this spec

@otzy007
Copy link

otzy007 commented Oct 10, 2014

@cognitiveflux I'm using just BW::Location.get without any parameters.
This bug that I'm having in the simulator, kCLErrorDomain code=0, happens in the RubyMotionSamples repo too. It's probably a simulator bug.
I'm all 👍 👍 to merge it 😉

@cognitiveflux
Copy link
Contributor Author

@otzy007 would you mind trying your test against #432 to see if that resolves it?

@markrickert
Copy link
Collaborator

Finally getting around to merging this so i can release a new version. Sorry about the delay and thanks for the contribution!

markrickert added a commit that referenced this pull request Jul 10, 2015
…didUpdateLocations

Updated CLLocationManagerDelegate method for locationManager:didUpdateLocations
@markrickert markrickert merged commit ae31898 into rubymotion-community:master Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants