Username or E-mail
Password (Forgot?)
New? Sign Up
Join or Sign In
Forums Stencylpedia Stencyl TV Translations Go Pro - Plans & Pricing Download Stencyl


Switch to Book Layout

1: Getting Started

  • Getting Started
  • Crash Course
  • Crash Course 2
  • StencylForge

2: Building Logic

  • What is a Behavior?
  • Creating a Behavior
  • Attributes
  • Game Attributes
  • Attribute Types
  • Events
  • Our Behaviors

3: Actors

  • What are Actors?
  • Animations
  • Motion & Forces
  • Physics
  • Controls
  • Collisions & Groups
  • Killing vs. Recycling
  • Tweening
  • Effects
  • Chapter 3 Challenge

4: Scenes

  • Scene Basics
  • The Camera
  • Tilesets
  • Regions
  • Drawing Text & HUDs
  • Changing Scenes
  • Music, Sounds & Channels
  • Backgrounds
  • Customizing Actors
  • Chapter 4 Challenge

5: Game Mechanics

  • Saving
  • Pausing
  • 3rd Party Services
  • Web Requests

6: Advanced Topics

  • Get/Set Attributes
  • Custom Events
  • Blending Modes
  • Lists
  • Custom Blocks
  • Continuous Collisions

7: Testing & Tuning

  • Testing Games
  • Optimizing Performance 1
  • Optimizing Performance 2

8: The Last 10%

  • Flash Publishing
  • Standalone Apps
  • iOS App Store
  • Chrome Store
  • Making Money

M1: Mobile - Intro

  • Getting Started
  • Testing on your Device
  • Flash -> iOS Guide

M2: Mobile - Basics

  • Atlases
  • Drawing Text
  • Retina Display
  • Accelerometer
  • Joystick
  • Universal Games

M3: Mobile - Services

  • iAds
  • Game Center
  • In-App Purchases

M4: Mobile - Publishing

  • Debugging
  • Publishing to the App Store
  • Optimizing Performance
  • Promoting your Game

A: Troubleshooting

  • Showstoppers
  • General FAQ
  • iOS FAQ
  • The 90% Memory Warning
  • Recovering Broken Games
  • Can't Export to SWF
  • Reloading Documents
  • Generating Logs
  • Flash Security Settings
  • How to Report Bugs

B: How-To Guides

  • Importing Assets
  • Scene Designer
  • Code Mode
  • Font Editor
  • Pencyl (Image Editor)
  • Tile Editor (Shapes)
  • Game Cleaner

C: Reference

  • Glossary
  • Block Reference
  • Useful Shortcuts
  • Stencyl API

D: Resources

  • Stencyl TV
  • Abigayl's Guides
  • Giving Critiques
  • Creating Extensions
  • Translating Stencyl
  • Credits

3.0 Drafts (In Progress)

  • What's New in Stencyl 3.0?
  • Setup (Android)
  • Setup (Desktop)
  • Setup (iOS) - Concepts
  • Setup (iOS) - Mac
  • Setup (iOS) - Windows
  • Testing iOS on Windows
  • iOS Troubleshooter

  • Mobile App Scaling
  • Full Screen Mode
  • Simple Physics
  • Backgrounding an App

  • iOS App Store
  • Mac App Store
  • Windows Store
  • Google Play
  • HTML5

  • Android Ads
  • Android Purchases (WIP)
  • 4" Form Factor (iPhone 5)
  • Mobile Input
  • Mobile Features

  • Extending the Engine
  • iOS / Android Extensions
  • Developing the Official Extensions
  • Developing the Engine

  • iAds (Revised)
  • Game Center (Revised)
  • iOS Purchases (Revised)
  • Atlases (Revised)
  • Drawing Text (Revised)
  • Joystick (Revised)
  • Accelerometer (Revised)
  • Sounds (Revised, WIP)
  • Debugging (Revised, WIP)
  • iOS Performance (Revised)
Level: Beginner

Debugging Your iOS Game

At some point during testing, your game may quit unexpectedly to the home screen. This guide explains what to do if this happens.

 

Viewing Device Logs on Windows

If you're on Windows or even on a Mac, viewing the console logs for your device when it's running your app untethered from Xcode is very useful. There are various ways to do this.


Method 1: Use the Console App

This app displays your device's console logs. Useful if your game crashes, and you don't know why.

http://itunes.apple.com/us/app/console/id317676250?mt=8

Pros: For quick checking
Cons: Hard to get the info off the device. E-mailing it to yourself is your best bet.


Method 2: Use iTunes

http://aplus.rs/apple/how-to-find-crash-logs-for-iphone-applications-on-mac-vista-and-xp/

Pros: Better for generating bug reports or a more detailed look
Cons: Harder to get to because you have to hook the device up


Understanding Crashes

Crashes are errors in your game’s logic or the Stencyl engine that cause the game to suddenly quit. Many types of errors can cause crashes. The most common ones include the following:

  •    Referring to something that no longer exists, such as a dead actor.
  •    Doing something illegal, such as dividing by 0 or attempting to grab an element from a list that does not exist.
  •    Performing an operation on something that doesn’t support that operation.

 

When you test your game, the OS X Console app pops up. Don’t close this! It’s a useful window that displays your game’s output and crash information.

When a crash happens, the iOS simulator (or Xcode, if you’re testing on the device) will generate a crash log and sometimes display the stack trace, the sequence of events that took place before a crash, for the error in Console.


Crash Logs: Where to find them

Crash logs describe exactly what led to the crash. You can find them in the Console’s sidebar under User Diagnostic Reports.

To locate the Crash Log so you can attach it to a forum post or e-mail, right-click the entry, and either select Mail or Reveal in Finder.


Stack Traces: What caused the error?

A stack trace is the sequence of lines of code that the engine executed before the crash, where the items at the top happened LAST, and the items toward the bottom happened FIRST.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                  0x017da09b objc_msgSend + 15
1   AppScaffold                      0x000276b4 -[Script sameAs:two:] + 36 (Script.mm:88)
2   AppScaffold                      0x00008697 -[HUDDrawer render:x:y:] + 327 (HUDDrawer.mm:65)
3   AppScaffold                      0x00023307 -[Behavior render:x:y:] + 103 (Behavior.mm:202)
4   AppScaffold                      0x000282dd -[BehaviorManager draw:x:y:screen:] + 221 (BehaviorManager.m:147)
5   AppScaffold                      0x00051a12 -[Game render:] + 242 (Game.mm:1689)

Don’t fret over the details.

The key takeaway is to recognize a stack trace when you see one. Sometimes, but not always, you can recognize a behavior’s name from the stack trace and begin your investigation there.

In this case, the “HUDDrawer” behavior (shown on line 2 above) is at fault, so you would check that out.

The difference between a stack trace and a crash log is that a stack trace is part of a crash log. A crash log can contain multiple stack traces and other information.

 

How to Effectively Debug Your Game

Putting the elements discussed previously together, you can now debug your game when it crashes. Here’s a summary of what to do:

Step 1: Make the crash happen again (“repro,” short for “reproduce,” the problem)
This will cue you in on what actually caused the problem.

Step 2: Examine the game logs and stack trace in Console
See if you can recognize your behaviors. Is it something you can trace back to your game and fix?

Step 3: Tinker with your game to isolate the issue
If you can’t recognize the faulty behavior, disable suspicious behaviors, based on what you know causes the crash, until the game no longer crashes.

Once you’ve figure out the offending behavior(s), try to narrow it down to particular blocks, if possible. If you are unable to fix the issue, or if you think it’s a problem on our end, follow the instructions below.


If all else fails...

If you get stuck or discover that the issue is beyond your control, contact us on the forums.

Provide the following:

1) Crash Log (link back to above)

2) Exact steps taken to make your game produce the crash. If the crash happens randomly, let us know.

3) A ZIP of your game’s project, if possible. If not possible, e-mail us the project or generate a simple test case game that demonstrates the issue.



Last Updated: 2013-04-11 by Jon

8066 have read this article
Disclaimer: The Stencyl Team does not actively monitor comments on articles. If you're seeking help for your game, please ask a question on the forums. Thanks!
0 Comments
Be the first to make a comment!



Commenting Guidelines

Sign In to Comment

Make Games

  • What is Stencyl?
  • Roadmap
  • Pricing

Play

  • Arcade
  • Showcase

Community

  • Forums
  • Chat
  • Translations

Help

  • Stencylpedia
  • Stencyl TV

About Us

  • Blog
  • Contact Us
  • Press
  • Privacy
Follow Stencyl on Twitter



© 2013 Stencyl, LLC.