zoukankan      html  css  js  c++  java
  • 标准的数据获取 -ios

    #define kBgQueue dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)

    #define kLatestKivaLoansURL [NSURL URLWithString:@"http://api.kivaws.org/v1/loans/search.json?status=fundraising"]

    dispatch_async(kBgQueue, ^{

            NSData* data = [NSDatadataWithContentsOfURL:

                            kLatestKivaLoansURL];

            [selfperformSelectorOnMainThread:@selector(fetchedData:)

                                   withObject:data waitUntilDone:YES]; });

    - (void)fetchedData:(NSData *)responseData {

        //parse out the json data

        NSError* error;

        NSDictionary* json = [NSJSONSerialization

                              JSONObjectWithData:responseData //1

                              options:kNilOptions error:&error];

        NSArray* latestLoans = [json objectForKey:@"loans"]; //2

        NSLog(@"loans: %@", latestLoans); //3

    }

  • 相关阅读:
    vector数组的翻转与排序
    20210310日报
    vector数组的遍历
    vector数组的删除
    vector数组的插入
    20210304日报
    20210303日报
    20210302日报
    计算datetime.date n个月后(前)的日期
    pandas 重命名MultiIndex列
  • 原文地址:https://www.cnblogs.com/jiackyan/p/3490731.html
Copyright © 2011-2022 走看看