iOS: Application crashes after getting restarted after memory issue termination - ios

I have an application written in Swift 2.1, under XCode 7.3. The steps to reproduce the issue are as follows:
Run application and then move it to background (etc. open another app etc.).
Play with other apps until our app gets "Terminated due to memory issue".
Try relaunching application through recently used apps menu (the one that shows after double clicking the Home button).
And now weird things happen. If the application is connected to XCode, the restart is flawless: app gets cold start and is running fine. However, when it is running standalone it crashes after few seconds of displaying last frozen screen. I am totally stuck: there is neither any sign of this crash in device logs, nor Crashlytics which we use to report crashes sends anything. There is also no problem with optimization, as some folks have suggested in other similar situations, since it happens on the same exact debug build. What is more surprising, the app launched from spring board starts normally. I would be grateful even for hints how to tackle this situation.
EDIT:
I forgot to mention that this behaviour is 100% reproducible on iOS 9.3 and 9.3.1. I have encoutered it on iPhone 4S and 6S Plus.

Related

Iphone App developed with KivyMD Crashing

I've created a game with KivyMD and currently I am testing it on iOS. I have tested the game on Android and it works flawlessly. The game builds successfully in XCode and once built, the game works fine on an iPhone. However, few days later, something seems to be going wrong and app starts to crash in iPhone. As soon as I launch the game, I see a black screen which appears to be a pre-splash. However, I haven't set a pre-splash for the game. If I rebuild the game in XCode again, it builds successfully with no errors and the app starts to work fine again for few more days and then it starts to crash. Can someone help me with the following?
Is there a way to look at the error message in some log file on iPhone when the app crashes?
Is there a debugging tool that I can use to troubleshoot when the app crashes?
Is there an iOS simulator app that I can use on my iMac to test the app?
XCode shows the build log as successful always. So, the app crashing appears to be a run-time error. Unfortunately, I am new to this and needs some help.
Thanks in advance.
UPDATE: You'll probably want to find a solution that is specific to Kivy. This answer may help. In fact, your question may be considered a duplicate:
https://stackoverflow.com/a/27175629/2476389
Generally, I recommend Firebase Crashlytics for crash logs. If a crash occurs in your app, the stack trace and other helpful info will be uploaded to your Firebase console the next time the app is started. You can see all your crashes in the console. You will need to follow the instructions to integrate crashlytics into your app and then release a new build, but it's well worth it. This will allow you to get crash logs from all devices (testers, users, etc).
https://firebase.google.com/docs/crashlytics
For crashes you can reproduce on your dev device, you can also retrieve the log directly:
https://developer.apple.com/news/?id=nra79npr

"Sideloaded" iOS app unavailable after sideloading to another device [duplicate]

I am currently working an iOS app, nothing serious, just a simple budget tracker. The workflow is the following: coding some new stuff into app => connect my iPhone to my mac => building app with Xcode to my iPhone 6 and my wife's iPhone 6 plus (so two different device!). At this point everything works fine.
But after a while (sometimes just a few days, sometimes weeks), the app suddenly stop working on both devices at the same time, without any foreshadow: We don't update iOS and don't do any changing in the environment, the app just start to do like this: https://s3.amazonaws.com/sized-video-assets-public-v1/wp-content/appadvice-v2-media/2015/07/crash_9b28fddfc26f9f0380f1b0d0b2324018-quarter.gif (but in my case, the app can't reach the first view, crashing immediately after start).
The most weird thing is, the crashing issue starts exactly the same time on both different device, but the "no-problem interval" is never the same: sometimes the crash starts after one day, sometimes after two weeks, etc.
After I rebuild the app to devices with Xcode, the whole thing starts over, and the app works fine for a while.
I already tried these things to debug this problem:
Fixing all the warnings cased by the Swift's frequent syntax change, so my app always free of warnings => same problem still there
Checking the diagnostic debug logs on devices, no logs for the time of crashing
Checking memory usage on startup, its about 25MB on login screen (first view), and the max memory usage is about 38-40MB in the app.
Debugging app with Xcode, but as I mentioned above, there is no errors/warnings, and after the successful build, the app works fine again.
What is happening here?
If application is installed with XCode and you don't have a Paid Program Developer Account, the life expectancy of the app is like 48h approximately
(There is no official time of validity for that)
, for a paid program, it's a few month with the correct certificate. Currently it seems to be approx 60 days.
If you didn't sign your app, it has low life expectancy. It's quite new that Apple allow you to deploy for a free account, but it just for testing purpose (other than simulator), if you want more days to test on device, you have to pay for the developer program.
Hope This will help you...
Do let me know if you have any other query.

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/

My WatchOS2 app stuck on launch with Spinner

I built a demo app on WatchOS 2.0.1, on every launch it was getting stuck with App name on Top Left corner and spinner in middle of screen on iWatch (38mm). Watch is brand new and have only native apps installed till now so there should not be any issue with memory.
I tried many times to open the app but it was repeatedly closing automatically after showing Spinner for sometime. After lots of trial my Apps screen got visible and then after on every launch it worked fine without sticking on launch. I tried to double check by Force quit my app using Power button but it worked fine then after.
Then I uninstalled the app from watch and reinstalled it and same thing happened again. It started sticking. Do anyone have Idea on this? Please help on this part.
WatchOS Version : 2.0.1
Your app is crashing, as evidenced by it "automatically closing."
You should be able to track down the reason for the crash by examining the crash report (which can be found in the Xcode Window -> Devices pane). Alternately, you should be able to interactively debug this by running the app within Xcode.
As for it eventually no longer crashing until you deleted and reinstalled the app, the app reached a state where the reason for the crash no longer occurred. This probably is related to needing to handle some error pertaining to a path or file which it is finally able to create or access. Deleting the app recreated the condition where it repeatedly crashed again.

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.

Resources