gpt4 book ai didi

ios - 如何从网络服务加载数组?

转载 作者:行者123 更新时间:2023-11-28 22:33:16 26 4
gpt4 key购买 nike

我有一个像这样的静态数组。这是静态数组。我想从 Web 服务加载。例如

 - (void)viewDidLoad
{
[super viewDidLoad];

tableData = [NSArray arrayWithObjects:@"Egg Benedict", @"Mushroom Risotto",
@"Pig spit-roast", @"goat", @"beefed up beef", @"squidles",
@"whale", @"crabbies", @"quack", @"Instant Noodle with Egg",
@"Noodle with BBQ Pork", @"Japanese Noodle with Pork",
@"Green Tea", @"Thai Shrimp Cake", @"Angry Birds Cake",
@"Ham and Cheese Panini", nil];

}

我想从这样的服务中加载所有食物

     NSString *soapMessage =[NSString stringWithFormat:

@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
"<soap:Body>"
"<List xmlns=\"http://tempuri.org/\">"
"<Foods></Foods>"

"</List>"
"</soap:Body>"
"</soap:Envelope>"
];

最佳答案

使用这个 XML 解析库:TBXML

然后按照这个分步教程进行解析:xml-parsing-using-tbxml

希望对你有帮助。

关于ios - 如何从网络服务加载数组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16837187/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com