PDA

View Full Version : Taking a score, saving it, then sending it to iPhonelb.com??




RobertD63
Jul 30, 2009, 04:38 PM
Okay guys, If your willing to help heres my little pickle im in. :o

I have an App called ReAct (http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=317036237&mt=8)(I know, we've all seen it) and I wanna know how to be able to save the reaction time then when the user taps the button to send it off to iPhoneLB.com Here is a video showing (http://www.youtube.com/watch?v=9bik9q9d4kc)you a little more. THe video is a little dated because I over looked the first part and forgot to put in a [alert show]; function.

Anyways would I make an array or something? I'm a very beginner Developer and if you cant tell I suck at it. But I'm hoping to get better:confused:

Thanks in advance!



dejo
Jul 30, 2009, 05:00 PM
You need to connect your button to the IBAction. Normally, this is done in Interface Builder.

RobertD63
Jul 30, 2009, 05:05 PM
Oops I forgot to say the it shows the UIAlert and everything. Now my main focus is to take the last reaction time, save it, then send it off to iPhoneLB.com for the high scores. :) Sorry for not being clear

dejo
Jul 30, 2009, 05:20 PM
So, you're stuck on Step 4? If so, the problem probably is your trying to call submitHighScore: from within your view or viewController but it's defined in your appDelegate. You'll want to do something like this instead:
AppNameAppDelegate *appDelegate = (AppNameAppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *response = [appDelegate submitHighScore:@"brandontreb" score:199.5 url:@"http://twitter.com/brandontreb"];
P.S. Replace "AppNameAppDelegate" with the real name of your AppDelegate class.

RobertD63
Jul 30, 2009, 05:29 PM
Yea I see that but wouldn't it send the same score every time? and everything else would remain the same?

Edit: I just want the user to be able to their last reaction time to iPhoneLB.com using submitHighScore thats already been called. If that makes it any clearer?

dejo
Jul 31, 2009, 09:56 AM
Well, you also need to replace the values for the parameters to submitHighScore: with more appropriate values, including the score. You were able to include the score in the alert, right?, so it's already in a variable? So, something more along the lines of:
NSString *response = [appDelegate submitHighScore:userName score:userScore url:userURL];
where userName and userURL are NSStrings for the current user and userScore is a float containing their reaction time.

This is all fairly basic Objective-C stuff. Perhaps it is time to step back from the real code and relearn the basics before continuing on.