ARDUtilities.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright 2014 The WebRTC Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import <Foundation/Foundation.h>
  11. @interface NSDictionary (ARDUtilites)
  12. // Creates a dictionary with the keys and values in the JSON object.
  13. + (NSDictionary *)dictionaryWithJSONString:(NSString *)jsonString;
  14. + (NSDictionary *)dictionaryWithJSONData:(NSData *)jsonData;
  15. @end
  16. @interface NSURLConnection (ARDUtilities)
  17. // Issues an asynchronous request that calls back on main queue.
  18. + (void)sendAsyncRequest:(NSURLRequest *)request
  19. completionHandler:
  20. (void (^)(NSURLResponse *response, NSData *data, NSError *error))completionHandler;
  21. // Posts data to the specified URL.
  22. + (void)sendAsyncPostToURL:(NSURL *)url
  23. withData:(NSData *)data
  24. completionHandler:(void (^)(BOOL succeeded, NSData *data))completionHandler;
  25. @end
  26. NSInteger ARDGetCpuUsagePercentage(void);