所以我试图在这里和httpebble库一起关注 Pebble SDK。
假设DictionaryIterator* received
包含以下 JSON 有效负载:
{"0":["Oz Lotto","Powerball","TattsLotto","Super 66","Monday & Wednesday Lotto","The Pools"],"1":["17, 26, 38, 7, 36, 45, 9 (44) (41)","15, 37, 32, 6, 24, 10 (11)","37, 12, 15, 16, 42, 45 (6) (9)","1, 8, 5, 8, 8, 5","16, 40, 44, 8, 24, 15 (39) (3)","5, 17, 20, 22, 27, 31 (16)"]}
主.c:
我希望能够提取数据以便稍后将它们存储到我的 Pebble 应用程序的列表中。我在理解 a 的Tuple
工作原理时遇到了一些麻烦。
这是我到目前为止所拥有的,但恐怕我不确定如何从lotto_names
and中实际提取值lotto_numbers
。
void http_success(int32_t request_id, int http_status, DictionaryIterator* received, void* context) {
if (request_id != HTTP_COOKIE) {
return;
}
Tuple *lotto_names = dict_find(received, 0);
Tuple *lotto_numbers = dict_find(received, 1);
for (int i = 0; i < 5; i++) {
const char* lotto_name = lotto_names[i]; // ?
}
}
我还在Pebble SDK 论坛上问过这个问题。但是没有人回复我的帖子。任何帮助,将不胜感激。