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

[BUG] location not updating if app is in background #96

Open
mattiamalonni opened this issue Dec 28, 2021 · 10 comments
Open

[BUG] location not updating if app is in background #96

mattiamalonni opened this issue Dec 28, 2021 · 10 comments
Labels
bug Something isn't working
Milestone

Comments

@mattiamalonni
Copy link

Describe the bug
Location not updating if app is in background mode

To Reproduce
Steps to reproduce the behavior:

  1. Open the app
  2. Use it normally
  3. Open another app and keep it on focus
  4. After a while, location will not update

Expected behavior
Location will still update, even if is in background

Desktop (please complete the following information):

  • [NO] Installed via homebrew ?
  • macOS: 12.1
  • LocationSimulator version: 0.1.8 (1)

Smartphone (please complete the following information):

  • Device: iPhone X
  • OS: 15.2
@mattiamalonni mattiamalonni added the bug Something isn't working label Dec 28, 2021
@mattiamalonni mattiamalonni changed the title [BUG] location not updating if app in background [BUG] location not updating if app is in background Dec 28, 2021
@Schlaubischlump
Copy link
Owner

I already noticed this as well. This has to do with the BackgroundQueue I use in the LocationSpoofer class. I already read the docs, but I have no idea how to accomplish this...

@Schlaubischlump Schlaubischlump added the awaiting user response Waiting for an answer from the user label Mar 15, 2022
@Schlaubischlump
Copy link
Owner

I tried to reproduce this behaviour on mac OS 12, and for some reason the error does not occur. Can somebody else verify that the behaviour did indeed change ?

@Schlaubischlump
Copy link
Owner

Should be fixed in v0.1.9. I removed the usage of NSTimer / Timer and use a DispatchQueue instead. This should work even if the app is in the background.

@Entrepren
Copy link

Entrepren commented Apr 28, 2022

Sorry, but the bug is persistent in version 0.1.9.1. The active window must be the location simulator app. Otherwise there‘s the message „Error changing location“ (#117 (comment)).

And so you can’t use location simulator with two instances of the app, because only one window can be in foreground.

iOS 15.4.1 and macOS 12.3.1

@Schlaubischlump
Copy link
Owner

Schlaubischlump commented Apr 28, 2022

First thing first: Running two instances at the same time is not a scenario I actively test or support. That being said:

I can not reproduce this behaviour. I started two instances of LocationSimulator via terminal and started spoofing on both instances. Then I put a different app in the foreground. Everything is working. Can you write down step by step instructions of how to produce the error? The error message indicates, that there is a problem setting the location. The error described in this issue addresses the problem, that the interface is not updating since the queue is not sending any more updates. This here is a different error, since the update is send, but it fails. This is therefore a different (new ?) bug.

I assume you did not try to spoof the location of the same device with both instances of LocationSimulator, because this will obviously not work.

Can you send me your LocationSimulator log. Click on Help -> Log... and Export. This generates a log file which you can upload here (Note: It might contain your device ids and names).

@Schlaubischlump
Copy link
Owner

I took a look at the logs. The error occurs somewhere deep down in libimobiledevice. When trying to connect to the device lockdown returns error code -5, which means LOCKDOWN_E_SSL_ERROR. I'm not sure why this error occurs. It could be some coding error on my end or some error inside libimobiledevice. In every case it seems strange, that it only occurs when interacting with the mac. I try to investigate I little more and see if I find something out. It could very well be, that this error is out of my control and even out of control of libimobiledevice.

@Schlaubischlump
Copy link
Owner

Schlaubischlump commented Apr 28, 2022

Okay seems like the navigation is still paused when the app is in the background for too long... That means the original error does still exist. The location is updated just not as often as it should be. This seems like a system optimization to save computing power. Don't know if I can do anything about this.

Nevertheless I'm unable to reproduce the newly reported error. In every case I keep this issue open for now.

@Entrepren
Copy link

The iPhone is connected via original lightning to usb-a cable and usb-c to usb-a adapter (both from Apple Store). I will try a usb-c to lightning cable later to exclude adapter related problems and report if this changes anything.
Maybe iPhone 6s is short on RAM? Will try iPad instead.

@Schlaubischlump
Copy link
Owner

Both good ideas. I debugged using the Wi-Fi connection. I'll try again via a USB connection. The USB connection is faster, maybe this contributes to the error.

@Entrepren
Copy link

Connection and cable checks revealed no further information. iPad same situation.
But I found out that running a specific tracking app (https://apps.apple.com/us/app/racemap/id640797527) on the iDevice AND leaving location simulator in background causes the error message. So I assume the problem is on the device/app side. Will send new log file

@Schlaubischlump Schlaubischlump removed the awaiting user response Waiting for an answer from the user label May 4, 2022
@Schlaubischlump Schlaubischlump added this to the v1.0.0 milestone Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

No branches or pull requests

3 participants