2011-08-06 3 views
0

Vous trouverez ci-dessous le code implémenté dans une application mobile Facebook pour le publier sur le mur de l'utilisateur. Comment faire pour modifier la valeur à Textview.text dans le mur de publication au lieu de l'utilisateur doit taper.Besoin d'aide pour comprendre cet extrait de code Objective-C

- (IBAction)publishStream:(id)sender { 
    SBJSON *jsonWriter = [[SBJSON new] autorelease]; 
    NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: @"Always Running", @"text", @"http://itsti.me/", @"href", nil], nil]; 
    NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 
    NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
          @"a long run", @"name", 
          @"The Facebook Running app", @"caption", 
          @"it is fun", @"description", 
          @"http://itsti.me/", @"href", nil]; 
    NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           @"Share on Facebook", @"user_message_prompt", 
           actionLinksStr, @"action_links", 
           attachmentStr, @"attachment", 
           nil]; 


    [_facebook dialog:@"feed" andParams:params andDelegate:self]; 
} 

Répondre

1
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
         nameTextField.text, @"name", 
         captionTextField.text, @"caption", 
         descriptionTextField.text, @"description", 
         hrefTextField.text, @"href", nil]; 
NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 

Je ne sais pas si vous permettez à l'utilisateur d'éditer tous, sinon il suffit de changer ceux dont vous avez besoin à un NSString vous définissez.

+0

Je le sais. J'ai déjà eu ça. Au-dessus du code est l'échantillon droit? où devrais-je changer à TextView.text – Noob

+0

bien maintenant que vous avez précisé ce que vous vouliez je vais modifier ma réponse –

+0

Je change le code comme ça. Le mur de publication demande toujours à l'utilisateur de remplir la zone de texte. NSDictionary * [attachment = NSDictionary dictionaryWithObjectsAndKeys: @ "Mon nom apps", @ "nom", @ "Mes applications titre", @ "légende", TextView.text, @ "description", @ "http : //myurl.net ", @" href ", néant]; – Noob

Questions connexes