I have my iPhone app running on device, I can see logs in xcode.
Then, I what to see logs about what is happening when app restart.
So, I press home button twice -> swipe up to stop my app, then launch the app again. But I can't see any log in xcode anymore.
How can I see logs of my app continuously before & after my app restart in xcode?
==== UPDATE ===
I mean app log. OK, I can narrow my question to: How can I see logs again after I restarted my app? (device is connected to my mac book , I saw app logs in xcode before restarting, but can't find a way to see app logs after I restarted my app).
You can't see logs of an app that is not running. I can tell you this if you're really curious : there is nothing to log anyway. :)
Now you might want one of those things :
System logs :
Just go in the Device Manager of XCode (short cut is Shift-Apple-2 I think). It's in the Window
Tab, under Devices
. Select the device you're running on, then you'll have the logs available there.
This logs everything the device logs, so there will be a LOT of text.
App logs :
Those are the ones you already have, but you seem to clearly want the "restart" logs of your app. There is no such thing as a restart log. What you have is the logs at the start of your app, and the ones at the end. For example, what you logged in your AppDelegate
's didBecomeActive
or willTerminate
(or even didEnterBackground
).
You will only see the logs of the didBecomeActive when you actually run the app from XCode (otherwise the debugger is offline). He will start the app as if you tapped on the app icon, so no worries there.
If you decide to kill the app by swiping up, it will log the app delegate, and you'll just be able to browse it in the debugger. You can put a breakpoint if you want to make sure it enters the AppDelegate
methods.
But if you want to restart the app again, you'll have to re-run it from Xcode, not manually start it on the phone.
File logging :
Another very easy solution is to log everything on a text file in the Documents directory of your app, you'll then be able to start/quit as much as you want, and let it log on the file. You can later read that file like any other file :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With