Game Development Reference
In-Depth Information
At a later point, you'll want to implement the corresponding equivalent of the applica-
tionWillResignActive: method in the LearnSpriteBuilderActivity
class. The equivalent method is the onPause method. For now, it's more important to get
the app running on the device. After this fix, compilation problems should be cleared and
the app should be transferred to the device.
Fixing Launch Problems
When you get the project to compile and transfer, you're getting close. Now might be a
good time to start fearing the worst launch issue of all: a black screen, app freezes, no in-
dication in the log.
If that were to happen to you, the best way to narrow down the cause is to add NSLog
statements. Start with the startScene method in LearnSpriteBuilderActivity.m as
shown in Listing 13-8 .
Listing 13-8 . Logging the launch of the first scene is a good idea
- (CCScene *)startScene
{
NSLog(@"startScene");
return [CCBReader loadAsScene:@"MainScene"];
}
If that doesn't log anything, you know the problem is related to the initialization of the
app. In that case, you should post the full log on the SpriteBuilder forum to request help.
This type of problem should be rare. As I found out, such issues can be related to the
Developer options —in my case, I had to enable OpenGL traces and Stay awake mode to
work around launch issues.
In this case, the project should launch fine until it raises a Java exception, which is printed
to the log including a (in this particular case, hardly useful) call stack. The error is reprin-
ted here:
W/System.err(17501): java.io.FileNotFoundException: Audio/
menu-music.m4a
W/System.err(17501): at
android.content.res.AssetManager.openAssetFd(Native Method)
Search WWH ::




Custom Search