Author Topic: App crashes on iPhone, works on Simulator  (Read 1269 times)

Gamingmayr

  • Guest
App crashes on iPhone, works on Simulator
« on: September 08, 2012, 08:51:28 am »
Hi! today I built an App. Works great on the Simulator, but crashes on the iPhone.
Please help me. Is it my mistake or is it because of the iOS Beta I have installed on my iPhone?
Oh: When I dont klick on any Button (except the send Button), the Mail Applicaton WILL open and not crash.
Code:

App.cpp
Code: [Select]
#include "DragonFireSDK.h"

char TextBuffer[500];
int Zutaten[8];
int Senden;
char Belag[500];
bool Kaese, Schinken, Speck, Ei, Mozzarella, Mais, Annanas, Thunfisch;

#include "Zutaten.h"

int on_Senden(int id)
{
if (Kaese==true)
{
StrAppend(Belag," Käse");
}

if (Schinken==true)
{
StrAppend(Belag," Schinken");
}

if (Speck==true)
{
StrAppend(Belag," Speck");
}

if (Ei==true)
{
StrAppend(Belag," Ei");
}

if (Mozzarella==true)
{
StrAppend(Belag," Mozzarella");
}

if (Mais==true)
{
StrAppend(Belag," Mais");
}

if (Annanas==true)
{
StrAppend(Belag," Annanas");
}

if (Thunfisch==true)
{
StrAppend(Belag," Thunfisch");
}

sprintf(TextBuffer,"mailto:TEST@SomeMail.com?subject=Pizza&body=%s",Belag);
BrowserLaunch(TextBuffer);
return (id);
}

void AppMain() // I don't think error is here
{
Zutaten[1]=ButtonAdd("Images/Kaese",0,0,on_Kaese,0);
Zutaten[2]=ButtonAdd("Images/Schinken",0,96,on_Schinken,0);
Zutaten[3]=ButtonAdd("Images/Speck",0,192,on_Speck,0);
Zutaten[4]=ButtonAdd("Images/Ei",0,288,on_Ei,0);
Zutaten[5]=ButtonAdd("Images/Mozzarella",0,384,on_Mozzarella,0);
Zutaten[6]=ButtonAdd("Images/Mais",160,0,on_Mais,0);
Zutaten[7]=ButtonAdd("Images/Annanas",160,96,on_Annanas,0);
Zutaten[8]=ButtonAdd("Images/Thunfisch",160,192,on_Thunfisch,0);
Senden=ButtonAdd("Images/Senden",160,288,on_Senden,0);
}

void AppExit()
{

}

void OnTimer()
{

}

Zutaten.cpp //don't think error is here
Code: [Select]
int on_Kaese(int id)
{
Kaese=true;
ViewSetVisible(Zutaten[1],0);
return (id);
}

int on_Schinken(int id)
{
Schinken=true;
ViewSetVisible(Zutaten[2],0);
return (id);
}

int on_Speck(int id)
{
Speck=true;
ViewSetVisible(Zutaten[3],0);
return (id);
}

int on_Ei(int id)
{
Ei=true;
ViewSetVisible(Zutaten[4],0);
return (id);
}

int on_Mozzarella(int id)
{
Mozzarella=true;
ViewSetVisible(Zutaten[5],0);
return (id);
}

int on_Mais(int id)
{
Mais=true;
ViewSetVisible(Zutaten[6],0);
return (id);
}

int on_Annanas(int id)
{
Annanas=true;
ViewSetVisible(Zutaten[7],0);
return (id);
}

int on_Thunfisch(int id)
{
Thunfisch=true;
ViewSetVisible(Zutaten[8],0);
return (id);
}
« Last Edit: September 08, 2012, 09:02:18 am by Gamingmayr »

graham

  • Guest
Re: App crashes on iPhone, works on Simulator
« Reply #1 on: September 09, 2012, 03:22:11 am »
The error is in AppMain.

You have declared an array Zutaten[8], which means that the indices go from Zutaten[0] to Zutaten[7]. If you assign something to Zutaten[8], you are overwriting something else in memory.


P.S.
"Ananas" hat nur zwei  'n' ;)

Gamingmayr

  • Guest
Re: App crashes on iPhone, works on Simulator
« Reply #2 on: September 10, 2012, 01:59:08 am »
Thanks! DragonfireSDK has the BEST Support and community.