Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 NSURL 中传递参数。例如,我有
NSURL *url = [NSURL URLWithString:@"http://demo.digi-corp.com:82/Nilesh/betBuddy/api/getEventsXML.php?sp_ID=2"];
sp_ID1、2、3、4 等在哪里。我该怎么做?请帮帮我。
sp_ID
您可以使用方法 [NSString stringWithFormat:@""] 来格式化您的 URL 字符串。例如,
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"http://e.com/?var=%d", 2]];
如果您在文档中查找字符串格式说明符,您可以准确地找出每种替换类型(整数、双精度、对象等)要使用的字符。