예를 들어 간단한 날씨 앱을 만들려고합니다. 내 것은 Air Quality API를위한 것입니다.C#, ios를 사용하여 API에서 JSON 주소 가져 오기
이 코드가 있지만 JSON과 작동하지 않을 것이라고 생각했습니다. 그런 다음
var webClient = new WebClient();
...
var text = e.Result; // get the downloaded text and store in this variable
string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string localFilename = "downloaded.txt"; // local file to save text in
string localPath = Path.Combine(documentsPath, localFilename); // local path to save file to
File.WriteAllText(localPath, text); // writes to local storage
myTextView.Text = text; // updates the TextView element on the screen with downloaded text data
JSON에 대한 인코딩 방법 그냥
var url = new Uri("https://api.breezometer.com/baqi/?lat=" + latitude + "&lon=" + longitude +"&key=YOUR KEY HERE");
webClient.Encoding = Encoding.UTF8;
webClient.DownloadStringAsync(url);
임 단지 확실하지. 사람이 대답하시기 바랍니다 알고 있다면 감사 ...
. 둘 다 더 간단한 api를 가지고 있으며 잘 문서화되어 있습니다. –