ios app crashes on re-open - ios

I've gone through and made sure the memory usage is good on my app and everything seems to check out. Most of the time when you switch apps and switch back, the app opens just fine. However, if you use the app a lot and then let the phone idle until it turns off and then turn it back on - the app will crash out after unlocking the device. How can I dissect what the reason is? Is there some kind of crash log kept on the device by chance?
*note I can't use xcode instruments for this particular situation because the phone will never idle it's self to sleep when connected to the cable and I can't get a crash by manually sleeping the device. I don't think idling to sleep is the issue, it's just something I have noticed before a crash happens.

You should be able to get to your device's crash log upon syncing.
OS X:
~/Library/Logs/CrashReporter/MobileDevice//
Windows XP:
C:\Documents and Settings\Application Data\Apple computer\Logs\CrashReporter\\
Windows Vista:
C:\Users\AppData\Roaming\Apple computer\Logs\CrashReporter\MobileDevice\\

Related

Device gets restarted when trying to run App

I have a iPhone 5 device that i use to test the app i'm trying to run. It has enough storage and runs other apps as expected.
I'm trying to run my app through xCode with this device but before it will start the app it restarts the iPhone and is not able to enter the app.
I think it is a memory issue that is causing the device to restart but i'm not sure where to look as i have tried both Instruments on the Mac as well as checking the log for the device, but because the app restarts every time on start up it does not record the data.
Is there any other app or another method i could use to see if there are memory leaks.
Try to view your iOS Device Logs from your Mac:
1- Connect the iPhone or iPad you want to view logs for to a Mac by using a USB connection, be sure to unlock the iOS device as well
2- Open the “Console” app on Mac OS, found in the /Applications/Utilities/ directory
3- From the Console app sidebar, look under the ‘Devices’ section and select the iPhone or iPad that is connected to the Mac
4- Console Log data will begin showing up immediately for the connected iOS device
And then you can analyze what cause this issue
I've recently come across this error again with xCode. After taking some time investigating and debugging using instruments, it showed there were a few memory leaks taking place during the start of the app.
In our codebase there were a few places where there were objects that were not assigned weak/ unowned, causing the memory leaks for those objects being used on start up.
After assigning weak or unowned to those objects, it solved the memory leak issues I was experiencing in the app.
For reference I used this article to understand the problem better:
https://medium.com/flawless-app-stories/all-about-memory-leaks-in-ios-cdd450d0cc34
Medium Article on the differences and how to use Weak or Unowned on a object:
https://medium.com/hackernoon/swift-weak-vs-unowned-by-examples-ffcc7c25ecc8#:~:text=The%20main%20difference%20between%20weak,will%20crash%20the%20whole%20program.

Crashlytics for iOS does logs crash only when app is opened after the crash

In an iOS Mobile App why does crashlytics log crash and send email, when the iOS app is opened after the crash. This behavior is not consistent when crashlytics is integrated with android app.
Typically after a crash, user will stop using the app and not open it again. As a consequence we end up missing several crashes which happen in iOS.
Mike from Fabric here. The behavior is different on each platform since each platform has different behaviors for exception handling and networking.
On iOS, it's unsafe to send much, if any, data after an exception happens that leads to a crash. The app is a horrible state and the device is also resolving an unexpected situation. If, we or other services, tried to send additional data then, you could run the risk of causing an issue on the entire device which it would require the device to restart. Asking a user to restart their device is a much worse behavior then having them need to relaunch the app.
You are correct that some users may never relaunch the app and those crashes are lost, but in general, we've found most users relaunch the app post-crash.
As #Dev_Tandel said, on Android, other background networking services can be used to try and send the crash report then. We will try to do that, but don't guarantee that a report will be sent until the app is relaunched.

My iOS app every now and then refuses to launch until I reinstall it

I've got an app that uses Core Data that sporadically stops launching so I have to reinstall it using XCode and then it launches again like normal for a while, with all the Core Data information still preserved.
I have seen that an app often stops launching when the target of an app is too low in comparison to the device software version, however this is not so for this app and device (iPhone 6s).
Have you had such an issue before? What do you think could be causing this problem?
There are many, many, many things that could cause an app to fail to launch. You need to narrow things down and collect some data so that you can find out what the problem is and do something about it. Right now you don't even know that it's related to Core Data, you're just guessing.
For a crash on launch, look at the device console and see what messages appear when you try to launch the app and it fails. You can get the device console messages by
Connecting your device to your Mac
Opening Xcode's "Devices" window (cmd-shift-2)
Looking in the bottom half of the window
A better way to watch the console is to use the free iOS Console app.
The problem was that, as mentioned by dan in the comments, the code was being signed for a short period of time (7 days) and so I had to keep re-installing it on the iOS device to keep it working. Thus to keep the app working indefinitely a paid developer account is needed.
Also mentioned in this reddit forum:
https://www.reddit.com/r/jailbreak/comments/4hotx3/news_free_developer_account_installs_reduced_to_7/

iOS: Simulating user quitting app

I just added persistent data into my app and wanted to test it with my iPhone. When I quit my app (double tap home and swipe up), I'm unable to open it again (the icon freezes). When I try the same thing on the iOS simulator in Xcode, it crashes too. I get a SIGTERM error coming from my AppDelegate. Is this what is supposed to happen when the user quits while testing, or is this an issue with my data? Is there any way to simulate the user quitting and restarting the app to make sure my data is still there?
Thanks
This is not what is supposed to happen when the user quits while the Xcode debugger is attached (at least not anymore — this question is a couple years old after all).
If you force quit an app while running from Xcode (whether simulator or on a physical device) it just stops the debugger and you should be able to relaunch it without issue. The Xcode debugger will not be attached when you launch like that, but from Xcode you can attach the debugger to an existing process (Debug > Attach to Process).
Note, if run in Xcode and then you quit the simulator application on your Mac (or close the simulator's window) then you will get a SIGTERM error in main.swift. But this is not the same as a user terminating your app, nor is it comparable to a user turning off their device.
From what you're describing it sounds like there is a bug in your code that is causing it to freeze when launching when the debugger is detached or when it's relaunching after termination.
To simulate the user quitting and restarting you should be able to terminate the app from your device/simulator, and then either run it again from Xcode or launch it from the device/simulator and attach to the process from Xcode.
In some cases it may be helpful to put in some debugging code that pops up an alert / update some label at runtime to indicate the data persisted properly after the app re-launched so that you don't always have to have Xcode attached to diagnose problems in your app.
This is the correct behavior if you are running the app from Xcode. However, once you've uploaded/run the app once, you can test closing and reopening it. Simply stop the run in Xcode, go to your phone or simulator, and click on the app icon to open it. Unfortunately, you won't have a debugger log at that point, but you can see if your data persists.

App Keeps Respringing When Launched

For some reason, whenever I try to run any app created in Xcode (even brand new ones), something happened (?) and now Springboard takes up a ridiculous amount of CPU until it launches. Once it's launched it's fine, but until then it will often respring if there's not enough memory. It runs fine in the Sim, just not on the physical phone. No clue why. I can provide logs or info, I'm just not sure what to put here; I've looked at most logs etc.
Where do you want to run the app? On a real device or in the Simulator? If you're using a real device, unplug it, open /Library/Developer/Xcode/iOS DeviceSupport and delete the folder with the iOS version of your device. After that, reconnect it. Does that help?
Also, please provide any logs you get and information about your system versions, devices and the Xcode version.

Resources