iPhone segment errors on device & crash - iphone

My latest iPhone/iPad application works fine on the simulator.
On the iPad, it works fine for sometime but then crashes. The console shows that it is dues to a segmentation fault that I am assuming is happening due to a message being sent to a zombie. Since this is happening only on the actual device it will not be possible for me to use the NSZombieEnabled/Instruments.
What debug options do I have in the absence of instruments/zombie-detection on actual device?
Code Review - Completed, did not find anything obvious
Put comments and follow through the narrow down on zombies - In progress
What else can I do? any suggestion will be appreciated.
I did go through the past questions but did not get many options to look at....I apologize in advance if this question is already answered but would appreciate if you could share the link or provide guidance.
R.S.

Look at this post to see how to turn on Zombie objects.
https://stackoverflow.com/a/4917557/613156
You can turn it on through the diagnostics panel and it will run on your device.

Related

How to use swift to detect app crash?

I am currently working on code to log a user's behavior in the app and to report crashes and the sequence leading up to them. I have one big problem, I do not know how to make my app detect if it has crashed. Does anybody know how to do this in swift? Your help would be much appreciated!
I don't think there is currently a way to do this. When your app crashes it ceases to function and all processes stop. Usually any crash and diagnostic data is sent via the user settings panel.
Edit: There is an helpful post here: https://stackoverflow.com/a/8242215/4891259
Hope that helps.

Recognise an out of memory crash (IOS)

Our apps are live on the app store.
I wish to recognise crashes of out of memory that some users are getting.
I understand there is no way to 100% recognise an out of memory crash.
Is there any way to recognise these crashes(with a pretty large probability) by doing some logic in the applicationDidReceiveMemoryWarning? (I am not talking about finding it in xcode during development time, i am talking about code that will recognise the out of memory crash from actual users and will log something to file)
While I was looking for any service or library that give me OOM tracking, I could only find this article from Facebook engineering:
https://code.facebook.com/posts/1146930688654547/reducing-fooms-in-the-facebook-ios-app/
The idea is to deduce the reason why the app needs to be launch, checking different aspects (like if the app was at background, if there is an app/OS update,...).
Discarding all the other possible reason that can force the previous app exit, you can know if the reason is a background out of memory or a foreground out of memory.
It would be nice to have a library that implements the Facebook article procedure. But nowadays I couldn't find any, probably there is some reason that make this difficult or may be impossible to add it as an sdk.
If anyone knows any service, please share it with everyone with a comment or a new answer.
Edit:
I have discovered this github (https://github.com/jflinter/JRFMemoryNoodler) with an implementation of the Facebook post procedure. I haven't tried yet, but we will deploy it in our apps to try it.
Look out for the applicationWillTerminate message in your app delegate. This is called if you app is terminated by the system (due to e.g. low memory), but not if the user leaves the app in the usual way by pressing the home key. Note: if your app is in the background and memory runs out, your app gets killed without any messages being sent to it.
YMMV, especially with older versions of iOS, and it's worth researching to ensure that the above is accurate.
The images at this blog post are quite informative (although slightly dated).
For more info, see How to know whether app is terminated by user or iOS (after 10min background)
Firstly Analyse your application by clicking on the Product at the top menu bar of your Xcode and click on Analyse section it will show you the number of leaks on in the application and can take you to the place where leaks occurred. This is how you can find the memory leak and rectify it.
Secondly it above does not worked then see to the view controller where crash occurred and check whether you have left any object to release.
Hope this might help you to resolve your problem.

Effective Xcode Debugging

When I got started in iOS dev, debugging in Xcode seemed like a pain. I used to get exec_bad_access issues & crashes at random points that took me ages to figure out the reasons behind.
I then stumbled upon Brad Larson's videos on debugging in Xcode and my life has never been the same. He showed how you could dynamically set a break point & get your app to break every time an exception was thrown. This allowed me to actually see the stack trace & figure out what was wrong in a jiffy. It made life a lot easier.
To the experienced developers out there, are there any more random tidbits such as this that you find useful?
SO itself is a nice resource:
Hidden Features of Xcode
How to print out the method name and line number and conditionally disable NSLog?
Memory leak detection tools

Application crahes when loading initially

We have the loaded the app in the itunes but it got rejected because of following issues...
How to overcome the crashing reports while loading initially
This is the message from apple's site...
"Here is how we found this crash: 1) Launch application while connected to cellular or WiFi network connection. 2) Tap on the Find My Location button. 3) Application produces a crash."
can anyone help me out.
Thanks in advance...
Have you followed Apple's advice at all and tried to reproduce the crash? Do that, and check all the methods related to the Find My Location Button. Good things to look for - double releases, nil objects, infinite loops, that you're targeting the right iOS etc. Beyond stating the obvious, no one here can help you until you help us!

Game crashes on the actual iPhone but simulator? memory problem?

I have built my first game using Cocos2D. It worked fine on the simulator. But when it runs on the actual iPhone, it crashes. I don know why. Thought it was memory leaks, so i tried to detect, but no leaks found. I tried to increase and decrease frame rate, neither both succeeded. Anyone experienced please help me out. I am really stressed now. If anyone had the same issue please share with me your opinion.
Yours thanksfully.
I've run into similar issues (I also use Cocos, but I don't think this is Cocos specific). The best thing to do is plug-in your iPhone and watch the stacktrace when it crashes (or retrieve the stacktrace after the fact)
This happened to me a lot because the resources between the iPhone and the simulator were not in sync; in other words, some how resources would be available to the simulator (eg: images) but those same resources were not transferred to the iPhone for whatever reason. Sometimes, if I ran 'clean' on the simulator, I would observe the same issue.
It's extremely frustrating to debug these types of issues, but you'll get used to it.
I agree with Dominic - we definitely need more information to be able to help you - do you have the output from the console or the stack from the debugger?
Also, while memory leaks are a Bad Thing, they rarely lead to crashes directly. They will increase the amount of memory used by your app so if you're memory intensive then you might get a problem but they're not the first place I'd look to try to debug this.
Try running the app in Instruments and watch the memory usage graph - then not only can you see the total that your app is using but you can get an idea of which sections of your app use the most and can focus your efforts in reducing it.
Sam
Sorry, but you need to specify more details. How does it crash? What does the error log say? One thing you might look into is the amount of memory, your game consumes. If it uses more than 64 MB on the actual device, the OS will very likely just terminate it. In the simulator on the other hand, your app might use lots more memory without a problem.
I have found tools like Instruments and NSZombieEnabled to be very helpful in tracking down issues such as these.
Without more information, I would try the following steps:
Delete the app from the device and simulator (using the tap-and-hold technique to make your icons jiggle) and reinstall it. Sometimes a setting (or lack of a setting) in the user defaults will cause a crash, and those don't get wiped out unless you delete and re-run your app.
Also try the "simulate memory warning" option in the simulator and see if that gets it to crash.