Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-27-2011, 05:44 PM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
bytor99999 is on a distinguished road
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default Best way to test and find crashes

I have bugs in my application that I would love to fix. But the problem is I can't always replicate it with the same conditions. And right now, I can't make it break at all. It seems to break when I am showing it off to someone else.

I don't have any crash reports on it to even help me out.

So what is the best approach to testing, different devices and finding some deep root causes of bugs.

Thanks

Mark
__________________
Perfect World Programming LLC
http://www.perfectworldprogramming.com

Please check out my apps.

TubeOrganizer
http://www.spritzlerapps.com/tube-organizer.html

Paper Clips
http://spritzlerapps.weebly.com/paper-clips.html
bytor99999 is offline   Reply With Quote
Old 06-27-2011, 06:29 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,003
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by bytor99999 View Post
I have bugs in my application that I would love to fix. But the problem is I can't always replicate it with the same conditions. And right now, I can't make it break at all. It seems to break when I am showing it off to someone else.

I don't have any crash reports on it to even help me out.

So what is the best approach to testing, different devices and finding some deep root causes of bugs.

Thanks

Mark


Intermittent bugs can be really hard to find. First step is to create a build where you have the source code unchanged, plus the exact executable and symbol file you are testing with. save the executable and symbol file in a second folder. The system uses the date stamp on the build to match the program and the symbol file to "symbolicate" log files, so you need to make sure you save the exact .app and symbol file that you test with. Rebuilding t without making any source changes will proven the system from matching the executable with the symbol file.

To fix this problem, you can give out a development build with symbols included. Just put your tester's UDIDs into the development profile. Give that out to testers, and teach them how to get crash logs from their devices and mail them to you. Also test the snot out of it yourself, trying to get it to crash. Sometimes the crash log shows the line that's the source of the bug.

Next, do a build and analyze on the program, and look through and fix every single problem it identifies with your code. Some, like unused variables, won't cause any harm, but it can be easy to miss a real problem if you have a ton of other issues flagged as well. Getting a build and analyze to run with no issues raised is a very good thing.

Also try running with the zombies tool in Instruments. That can find memory problems with over-released objects.

If it only crashes when you are demonstrating it, demonstrate it to people with a video camera recording the screen. Capture as many crashes as you can, and then go back and try to figure out what aspects they have in common. Frequently other people do things with your app that you don't. Programmers tend to get into a narrow path through their programs, without even realizing it. Users will do things we don't expect. That might be the reason you crash doing demos.

That's just some off-the-cuff advice. Good luck, and stick with it. Debugging takes patience and determination.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is offline   Reply With Quote
Old 06-27-2011, 10:59 PM   #3 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

What Duncan said in the second to last paragraph is exactly why developers generally don't (and shouldn't) test software as well.
baja_yu is offline   Reply With Quote
Old 06-27-2011, 11:22 PM   #4 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 22
MarkHolbrook is on a distinguished road
Default

I will add to this by saying that the behavior you describe sounds very much like memory issues.

I have a player app that has been running just fine for months. Never a crash. I added one line of code that allocated and assigned a data class:

playingSong = [[MJSongDataClass alloc] init];

This "playingSong" var was an instance var in a class. A while later something would try to access playingSong and the app would crash. I spent a while looking into it and surprisingly the thing that fixed it was a simple:

playingSong = [[[MJSongDataClass alloc] init] retain];

For reasons I cannot fully explain the allocated class would get autoreleased. Things like this can drive you crazy. Anyway your behavior sounds similar.

Spend the time to check and double check your memory handling.
MarkHolbrook is offline   Reply With Quote
Old 06-27-2011, 11:55 PM   #5 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

That doesn't seem right. allocation returns a retained object, so you're double retaining it and possibly creating a leak. Your problem is that you are over-releasing it somewhere.

Also, it's best to use properties to help manage memory for pointer type instance variables.
baja_yu is offline   Reply With Quote
Old 06-28-2011, 12:19 AM   #6 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 22
MarkHolbrook is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
That doesn't seem right. allocation returns a retained object, so you're double retaining it and possibly creating a leak. Your problem is that you are over-releasing it somewhere.

Also, it's best to use properties to help manage memory for pointer type instance variables.
I completely agree however I traced this object in extreme detail and and there was no release or dealloc being done. It just disappears. I've even had two other people look it over and they agreed... very strange.
MarkHolbrook is offline   Reply With Quote
Old 06-28-2011, 03:13 AM   #7 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

you can use a similar tool

plcrashreporter - In-process CrashReporter framework for the iPhone and Mac OS X - Google Project Hosting
https://github.com/guicocoa/hoptoad-ios
https://github.com/kaler/CrashKit
__________________
dany_dev is offline   Reply With Quote
Old 07-16-2011, 10:52 AM   #8 (permalink)
Registered Member
 
Join Date: Jan 2009
Location: Long Beach, CA
Posts: 612
bytor99999 is on a distinguished road
Send a message via AIM to bytor99999 Send a message via Yahoo to bytor99999
Default

Thanks guys, sorry it took me a long time to come back to this post, I was on vacation. I might have gotten a number of leaks with analyze and hope one of them that I fixed was the cause of their crashes.


I have been a developer for over 20 years with lots of debugging experience. iPhone development is not like any other language I have used. The whole finding a memory leak or crash like this is almost like looking for a needle in a haystack, and I get really confused by what Duncan posted about builds and symbols on and the creation of the ap file. I know it is probably just like creating a jar file in Java or turning on JPDA remote debugging in Java, or other language compiled artifacts, but I definitely, have to get used to the iOS way.

I also had to laugh about Duncan saying I give it to my testers. What testers? In my iOS development stuff it is just me, no one else.

Thanks

Mark
__________________
Perfect World Programming LLC
http://www.perfectworldprogramming.com

Please check out my apps.

TubeOrganizer
http://www.spritzlerapps.com/tube-organizer.html

Paper Clips
http://spritzlerapps.weebly.com/paper-clips.html
bytor99999 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 328
8 members and 320 guests
chemistry, Dnnake, iOS.Lover, lendo, leostc, Leslie80, pbart, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:29 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0