Created
October 21, 2016 11:18
-
-
Save christianwish/2749ebbeafcee5de52e46073e2848fbd to your computer and use it in GitHub Desktop.
Get json data by url in sketch plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get(queryURL) { | |
var request = NSMutableURLRequest.new(); | |
[request setHTTPMethod:@"GET"]; | |
[request setURL:[NSURL URLWithString:queryURL]]; | |
var error = NSError.new(); | |
var responseCode = null; | |
var oResponseData = [NSURLConnection sendSynchronousRequest:request returningResponse:responseCode error:error]; | |
var dataString = [[NSString alloc] initWithData:oResponseData encoding:NSUTF8StringEncoding]; | |
return dataString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment