Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID
Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.

Memory Issue

casahome2000casahome2000 Posts: 15Registered Users
I'm working on an app and the code complies just fine but during runtime the app crashes with the following problem...

GDB: Program received signal: "SIGABRT"
AND SOMETIMES THIS ONE (with no change in code)
“EXC_BAD_ACCESS”

In the Debugger you can see what memory location that is coming from and where it's coming from.


[timer invalidate];


I've tried different things i've found online but can't seem to get this solved.

Here's the code snipit from where i think the problem is. Let me know if there is something really odd about what i'm doing or if there is a error...or a better way. Any help would be great...it's just frustrating at this point!

//METHOD TO DETECT MOVEMENT IN iPHONE
- (void)accelerometer:(UIAccelerometer *)acel didAccelerate:(UIAcceleration *)aceler {

if (fabsf(aceler.x) > 2 || fabsf(aceler.y) > 2 || fabsf(aceler.z) > 2)
{
//TEST STATEMENT
[label setText:@\"You shook me!\"];
//SET PROGRESS BAR TO 0
progressView.progress = 0.0;
//INITIALIZE TIMER - SELECTOR TO MOVE PROGRESS
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(moveProgress) userInfo:nil repeats: YES];


}
}
-(void)moveProgress
{
progressView.progress = progressView.progress + 0.1;


if (progressView.progress == 0.5)
{
[progressLabel setText:@\"That's a tough one...\"];
}
if (progressView.progress == 1.0)
{

//END TIMER

[timer invalidate]; //PROBLEM????


//CREAT ARRAY FROM PLIST (IDENTICAL TO FLIPSIDE LOAD)
NSString *filePath = [[NSBundle mainBundle] pathForResource:@\"answers\" ofType:@\"plist\"];
//NSLog(filePath);
NSArray *array = [[NSArray alloc]initWithContentsOfFile:filePath];
self.answerList1 = array;
[array release];

// NSLog(answerList);
//STORE TOTAL ANSWER LIST COUNT
int numAnswers = [answerList1 count];
//RANDOM SELECT AN ARRAY INDEX
int randSelected = arc4random() % numAnswers;
//STORE THAT SELECTION AS A STRING (RANDOM PLIST ITEM)
NSString *selection = [answerList1 objectAtIndex:randSelected];

//OUTPUT THAT RANDOM SELECTION
[label setText:selection];
image1.hidden = NO;
progressView.hidden = YES;
[progressLabel setText:@\"\"];

NSString *soundPath = [[NSBundle mainBundle] pathForResource:@\"fortuneSound\" ofType:@\"wav\"];
SystemSoundID soundID;
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL fileURLWithPath:soundPath], &soundID);
AudioServicesPlaySystemSound (soundID);

}
}

Post edited by casahome2000 on

Replies

Sign In or Register to comment.