Im not sure why my app is crashing when run on an Ipad. Ive tried 2 Ipads.
The app is complete and works flawlessly when run in the simulator.
It is a card game that uses the Canvas for the card display.
I would compare the game to something like “Hearts” Or “Bridge” for example.
So the hands dealt and the cards played will change throughout the game.
The app always crashes after playing 3 games (aprox 5 -10 minutes later)
The code is good because it reads the same code for these 3 games over and over
Just before the crash occurs, what i notice is the cards that are supposed to have images are blank.
Im not aware of any way to clear an image from a canvas after one has been drawn. This is when the problem starts.
Once the canvas images go blank, then any touch event crashes the app. I have looked in the crash log but even after the symbolicate i only get:
4 myapp 0x00450590 0xff000 + 3478928
5 myapp 0x0045f026 0xff000 + 3538982
6 myapp 0x0045f170 0xff000 + 3539312
Any other crash usually just shows unhandled exception error.
here is how i display a card on a canvas. “Backdrop” is an iosimage property for the canvas.
if me.backdrop <> nil then
try
g.DrawImage(me.BackDrop , 0, 0, me.width , me.Height)
catch
end try
end if
Because this only occurs after a few games are played im guessing that this might be a resource problem with the canvas and the constant graphic changes.
Im not sure if a canvas is cleared before another image is drawn to or if they just do layers of images.
Im wondering if im coding wrong and something is consuming resources over a period of time.
Anyone have a suggestion how to check or test where resources are being used?
Ready to be released but i cant resolve this crash.
After reading through the Forum i stumbled accross the answer in another thread. IOSsound crash
The bottom answer from Tom.
My game uses the sound of the cards as they are played plus other game sounds. So over 3 or more games the sounds might be played 300 times.
I turned all sounds off and the game ran on autoplay for over 15 games straight.
However i still dont know how to do what is suggested:
[quote=355218:@Kevin Currie]After reading through the Forum i stumbled accross the answer in another thread. IOSsound crash
The bottom answer from Tom.
My game uses the sound of the cards as they are played plus other game sounds. So over 3 or more games the sounds might be played 300 times.
I turned all sounds off and the game ran on autoplay for over 15 games straight.
However i still dont know how to do what is suggested:
Anyone know how this is done?[/quote]
The docs contain an example:
Dim soundFile As FolderItem
soundFile = SpecialFolder.Documents.Child("MySound.mp3")
Dim mySound As New iOSSound(soundFile)
mySound.Play
I don’t recommend this way of playing sounds if it is just a notification sound.
If you have some music playing in the background, on an apple TV for example, using the above code will stop the music in the background, and won’t resume afterwards.
Using Jason King’s iOSKit, the following code is a better way of playing notification sounds:
[code]
Static soundID As UInt32
if soundID = 0 then
Declare Function AudioServicesCreateSystemSoundID Lib “AudioToolbox.framework” (inFileURL As ptr, ByRef SystemSoundID As uint32) As Integer
Dim f As Xojo.IO.FolderItem = xojo.io.SpecialFolder.GetResource(“NAME_OF_FILE”)
Dim url As New NSURL(f)
Dim res As Integer = AudioServicesCreateSystemSoundID(url, soundID)
res = res //break point here to verify that res=0 and soundID>0
End If
If soundID > 0 then
Declare Sub AudioServicesPlaySystemSound Lib “AudioToolbox.framework” (snd As uint32)
AudioServicesPlaySystemSound(soundID)
End If[/code]