0

我正在将数据从 iphone 应用程序插入服务器

 participant_id="1";
 NSString *post =[[NSString alloc] initWithFormat:@"participant_id=%@&question_id=%@&answer_text=%@&answer_option=%@",participant_id,question_id,answer_text,answer_option];

将上述行与其他代码一起使用,是否有可能从这一行NSString participant_id传递到服务器int participant _id

4

1 回答 1

0

当然,只需使用%dor%u格式说明符:

participant_id = 1 ;
NSString *post =[[NSString alloc] initWithFormat:@"participant_id=%d", participant_id];

有关完整列表,请参阅https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html

于 2012-08-30T06:19:13.400 回答