OS killing the app when it going to background - ios

I'm develop application on React native and have an unexpected behavior. When I minimize the app OS kill it, so when I come back to the app it start loads again. I just want to keep using app from the moment I minimezed it.
The same when I blocking device. Is it something wrong with my app or it's default behavior of OS?

It was caused by errors in "Release" build of the app. So, it's not a normal behavior!

Related

Debugging React Native apps in background

While testing a release build of our React Native app on iOS, we discovered a defect with an input component that only occurred after the app had been in the background for a longer time (e.g. 1h). Presumably, this occurs after the app has been suspended by the OS.
I'm now trying to debug this issue, but when I run the app on a test device in debug mode and connected to the React Native Debugger, turn the screen off for some time and then bring the app back to the foreground, it will show a red screen with Runtime is not ready for debugging. error. This does not happen when I immediately bring the app back to the foreground after turning the screen off, so I suppose it's also related the app being suspended.
We're using React 16.3.0 and React Native 0.54.0 (preparing an update in a separate branch).
Can anyone help me understand what's going on here, and provide a suggestion on how to debug this issue?
Could you use something like Sentry for bug reporting? Not only does it log JavaScript errors, but native crashes too. This is great for seeing continuous errors encountered by your users, whilst in production.
You could also run a production build and debug it via USB.
Navigate to Product > Scheme > Edit Scheme. Ensure you've selected Production in the Build Configuration. Also select Debug Executable.
Once the application launches, go to View > Debug Area > Activate Console. You should now see any native logs from your app.
Can't really help with the problem that you're facing but you should take a look at Reactotron for debugging in react-native.

why does my phonegap app restart if kept in background for long

my phonegap app restarts if kept in background for long. For example if i open my app the next day it relaunches rather than starting from where i left off. Otherwise it seems to preserve state perfectly.
I see this happening for some other apps too that are installed on the iphone like instagram, twitter, but not for facebook and whatsapp. Does iOS kill apps if in background for long? Can i prevent this?
I am using Phonegap CLI 6.0.1 (cordova build version 4.0.1) testing on iOS9. Let me know if any other information is needed. Thanks!
iOS will kill apps when it needs the resources. There is nothing you can do to prevent your app from being killed (by iOS or the user). This has nothing to do with your app being made with phonegap (or anything else).
You need to code your app to handle being killed. When the user chooses to use your app again (after it happened to be killed), your app should launch right back to where it was, restoring its previous state. This is what all good apps do.

ios app-on-device debugging events

Newbie here, so apologies if this is stupid question:
Are there any applications or solutions out there that would allow you access to debugging events on an app installed on your iphone? To be clear, this isn't an app I've developed, it's just on my iphone and is used as part of another solution which we are developing. Curious if there's a way to just watch the events on an app to help with debugging process.
Thanks.
If you make an app, and build it with a development release, and development signing, you can select to build+run it on a device. Then, you can use the Xcode debugger to see your logs / errors etc.
Steps:
Plug in iPhone
Start Xcode
Hit Build + run
Watch debugger
Logs are either made by the OS for certain things (NSinconsistency, bad constraints, race conditions in view presentation) or by you with NSLog.
Or did you mean when the app is not tethered to your computer? There are other tools for that - including just plugging the phone back in and downloading the logs off the device.

iOS6, Application receives SIGSTOP if installed from Cydia

I have an application that can be installed in two forms: .ipa file and a Cydia package. It works well on iOS5. But on iOS6 a strange thing is happening, when the app was installed from Cydia. When I press the Home button, iOS sends SIGSTOP and the app is terminated. I don't have UIApplicationExitsOnSuspend set to TRUE in Info.plist. Any ideas why it's happening and how to prevent this?
Also on iOS6, it became possible to delete a Cydia app from SpringBoard, which does not look like a good feature, because the app in Cydia is still shown as installed. Is there any flag to avoid this?
EDIT:
I found that my app was killed because of strange deadlock and crash report was not generated because device had too much crash dumps on filesystem (I found this in console log). After deleting few logs from FS, I came to this problem https://stackoverflow.com/questions/15164548/cocos2d-x-example-app-crashes-when-pressing-home. I'm not using cocos2d, but seems problem with OpenGL subsystem. It crashes even it's just initialised and not rendering anything. I was trying to call glFinish(), unload shader programs and [EAGLContext setCurrentContext:nil], but all of these do not help.
EDIT:
I solved this by full release of my rendering subsystem including OpenGL context when app is deactivated. Fortunately it was easy to do.

Can you enable watchdog in iOS for debug mode?

One of my apps got rejected because it exceeded the startup time limit. The watchdog process killed it. Is there any way you can enable this watchdog component in debug mode? I've read somewhere that it's disabled for debugging purposes (which seems logical to me). Just wondering if you can manually enable it with some setting or something.
Btw, I know how to fix this problem, moving the whole startup code to a background thread did the trick.
Anyone got an idea?
Well it's active when you launch an app not through Xcode (i.e. with no debugger attached), so you could just install your app via Xcode, unplug it, launch the app. Then you'll see if it takes too long. But really, you shouldn't be thinking that you need that as a feature during debugging. You should just return ASAP from applicationDidFinishLaunching and do your work later like you have mentioned.

Resources