ExistentialAudio/SwiftOSC

Lock device issue

ADE222070 opened this issue · 9 comments

Hi again,

So the other issue I'm experiencing (which could very well be my fault with implementing your code) is that when lunch the app, everything works great. When I click out of the app and reopen it still works.

When I lock the iPad I can't seem to get the server side to work without totally relaunching the app.

To test I am printing the message.description immediately after;
func didReceive(_ message:OSCMessage) {

I'm sorry if this does not make sense. I can create you another video if it makes things easier.

Thanks

I think there are some underlying issues with the sockets code I'm using or it may be just how iOS handles the situation. One way to get around this quickly is to restart the server in applicationDidBecomeActive.

Thanks, I did try this before raising an issue, the following is my code in AppDelegate.swift;

func applicationDidBecomeActive(_ application: UIApplication) {
         server.start()
         print("Restart Server in applicationDidBecomeActive");
}

my consol then printed Restart Server in applicationDidBecomeActive but the OSC server does not work.

Thanks

Aled

So based on some really quick initial tests, this issue does not seem to exist with iOS13 (iPadOS). When the iPad is locked the OSC messages continue to print in the console. After unlocking the device, it continues to work as intended. I need to spend more time testing but looks good at first impressions.

Just let me know if you're still having issues.

Hi there, sorry to be replying to an old issue, but I've just picked this project up again, and the issue is still here. I don't believe iOS13 fixed the issue, it seems that it needs to be locked for a few minutes before happening. When running off xCode it's instant and when using a simulator I can't reproduce the issue.

I now get "Message from debugger: Terminated due to signal 13"

Any help with this would be much appreciated.

Okay, I seem to have found a way of stopping it from crashing. The solution was adding
client = OSCClient(address: clientIPDefault ?? "127.0.0.1", port: clientPortDefault)
to applicationDidBecomeActive.

Once I do that the issue has now changed. The app will stop receiving OSC (no crash)(again only after locking and unlocking the iPad). I've tried added server.start() along with the line above, but no success.

Thanks

@aled2305 Did you find any solution... cause i am getting the same issue.. after lock unlock... app crash... i have solved the crash by solution you provided, but after app activate... i am not able to get any message..

@joyharsh13 sorry for the late reply, but I've only today managed to solve the issue!

Using the following code signal(SIGPIPE, SIG_IGN);

In my app I now have:

  func applicationWillEnterForeground(_ application: UIApplication) {
       signal(SIGPIPE, SIG_IGN);
   }

I don't think this really fixes the underlying issue, it just tells the app to ignore the warning and to continue.

I hope this helps you.