Taking a score, saving it, then sending it to iPhonelb.com??

Discussion in 'iOS Programming' started by RobertD63, Jul 30, 2009.

  1. RobertD63 macrumors 6502

    Joined:
    Feb 17, 2008
    Location:
    A place
    #1
    Okay guys, If your willing to help heres my little pickle im in. :eek:

    I have an App called ReAct(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 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!
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    You need to connect your button to the IBAction. Normally, this is done in Interface Builder.
     
  3. RobertD63 thread starter macrumors 6502

    Joined:
    Feb 17, 2008
    Location:
    A place
    #3
    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
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    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:
    Code:
    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.
     
  5. RobertD63 thread starter macrumors 6502

    Joined:
    Feb 17, 2008
    Location:
    A place
    #5
    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?
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    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:
    Code:
    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.
     

Share This Page