I have to fix some bugs in an app somebody else developed. I have not worked on iOS before.
The iOS app sends some data out every 15 seconds, this works fine. I can click the home button and go back into the app, works fine too.
Now the problem only comes when there is a change in the network, lets say I activate Flightmode.
When I go back into the app it crashes because of a NSRangeException. The problem is I can not get any Debug output out or anything, even if I put debug statements around all the places where this Exception can happen.
Could somebody give me a tip? How can a change in network have such a effect?
Related
I am working on a mobile application in Flutter to
create a Bluetooth connection
receive data from this device
plot them on the screen using SfCartesianChart
Everything works fine, except that after a while, the application freezes completely. There is nothing I can do but quit the application. I have looked at the "Flutter performance" section, but I can't find any useful indication. Also, I don't see any errors on my command line. It is a total mystery. I keep looking but it's hopeless.
Well, I never understand why people are giving a "-1" instead of explaining something but I appreciate your suggestions on how I can resolve this error.
Im facing an issue that i am unable to debug.
If i open the app, it opens normally and works. But if i launch the app and close the app within 1 second and then launch the app again, it crashes without error message.
How do i debug this as Xcode loses debug connection if i close the app?
I tried putting exception break point but since xcode loses debug connection, it wont trigger.
This ONLY happens when a user does the above mentioned steps (open, close within 2 seconds and open again).
Is there anyway to find out why the app is closing and why there is no error / crash message?
Clarification : The crash happens when user opens the app, within 1 sec terminates the app by manually by swiping up from recents menu and tries to open the app again within 1 or 2 seconds. (Open -> terminate -> open)
Let us imagine that you run the app and quickly force-quit. Then, if you start your second run of the app from the Xcode debugger, hopefully, you should see your crash in Xcode at that point.
If that does not work, you might consider a crash reporting tool (e.g., Crashlytics, etc.). That will help you monitor and track crash reports that happen (for both you and your users) in the wild. If you do this, make sure you test the crash reporting system with some forced crash/report because an absence of a report could just be a result of a misconfiguration, which is easy to do because the setup of these tools takes a little work the first time you do it. Just make sure you have the crash report system working with a positive crash report before you draw any conclusions from an absence of a crash report generated by this particular bug.
That having been said, the way these crash reporting systems often work is they capture the crash and send it the next time you start up the app. It seems like there might be a chance that your particular crash (firing it up after having quickly force-quit it the first time) is happening so fast that the crash reporting system may not have a chance to send off its report of the past crash. (That having been said, these are still invaluable for capturing information about user crashes that happen during the normal use of the app, so I would consider them even if it does not help in this particular scenario.)
So, let’s imagine that you are still unsuccessful in catching your crash for some reason. The last resort is to consider sprinkling your code with Logger/OSLog statements. The nice thing about these logging statements is that you can watch these logging statements on your macOS Console app. See WWDC 2020 Explore logging in Swift.
How can I close an app with system("/usr/bin/killall [appname]");
i used it but when I double tap on Home button to show background app. it still appear.
May help?
I deverlop on Jailbroken phone, I want to clear call_history.db, I guess I want to close MobilePhone app perfectly, after that I can delete on call_history.
I am not 100% sure for this answer. However, I believe if you double tap Home button it doesn't show you a list of background apps. It shows you a list of recently used apps.
As example, system may stop some of this apps due to low memory, but they are still on this list. If you click on any of stopped apps, they will be started by system again.
Based on this understanding. Most likely Killall actually worked fine (killed an app), but the app stayed in recent apps list. You don't need to worry about this list for your task.
I have a question which seems like it should be a fairly common occurrence. I am trying to test code which only runs the first time an ios application is installed. While in principle this is very easy, I'm having trouble with it behaving properly the second time the app runs (note, this is not crash related).
I have been force running the app for a second time using the "Application does not run in background" flag in the plist, and then just hitting the home button. This works great, except i stop getting log data after the first run.
Does anyone know how to test for this situation in a way where you can continue seeing the log information after the app closes? For example, if there is a way to attach the xcode logger to the new process id? Or just another way to force an app reboot without losing the logging feature?
Thanks in advance!
Use the debugger menu:
Product>Attach To Process
(Results may vary with different versions of Xcode).
Also, you might need to insert a sleep at the very start of your launch to catch the very early log messages.
EDIT: If you're on a device then you can use the Device Organizer (cmd+shift+2) to watch all logs on a device.
I have a question,
i carefully went through and thoroughly understood the tutorial for iOS Core Data.
The issue was that when i coded everything and run on iOS 4 with multitasking.. the program crashed when i re-opened it (kill task from fast app switching and relaunch)
Then i went curious and recode it on iPad (since it hasn't support multitasking) and it works fine...
I went to explore abit, and some says that the fast app switching kill app is like the OSX kill app and there is applicationTerminate method in the delegate file which maybe need some changes (based on the comment).
Could someone enlighten me on that issue? Is there anything additional that i need to do in order to have Core Data to support the Multitasking feature..
Thank you!
Update
Ok but the thing i am not getting is that.. once i killed the app.. go Fast App Switch, kill it... and when i re-run the app.. it crashed.. Do i need to add some stuff to the multitasking methods? It crashes even if its a basic app with 1 button... What are the states that i have to save?
Update
The app just freeze on its own
Update
Alright my bad, trying my best, for the one button app... I sticked a button in there, and for each click, it prints an NSLog and a label. When i build and run it, it works fine, clicking it prints them normally. After going to background and close the app.. it sends SIGKILL Then when i relaunch the app, it no longer prints to NSLog and crash there 0x98a450f0 <+0000> mov $0xffffffe1,%eax 0x98a450f5 <+0005> call 0x98a453d8 <_sysenter_trap> 0x98a450fa <+0010> ret 0x98a450fb <+0011> nop
Update
However when i open the Iphone simulator and run the program directly... without building it from xcode.. It works just fine and it was able to print that value. Same is true for the Core Data.. if i just run it from the Simulator. Kill it and re-run, it works fine.. Not sure what's going on
With iOS 4.0, your app may not receive a -applicationWillTerminate call. It may only receive a call to go into the background and then be killed.
When you get the call to go into the background you should dump as much memory as possible to avoid being killed, that includes saving your context and perhaps calling reset on the context to get it to drop its cache.
Other than that, no changes need to be made.
What crash are you seeing, a stack trace would be helpful to explore this further.
Update
Again What crash are you seeing?
Update
Freezes where? Where does it stop when you look at it in Shark or the debugger? You are not giving me a lot of information to go on here :)