Как я использую веб-сервис в Objective C?

Когда Mylyn не используется (т. Е. Не открывается ни Mylyn, ни активных задач), это никак не влияет на производительность. Если это вызывает проблемы с производительностью, пожалуйста, отправьте сообщение об ошибке, например:

Команда Mylyn считает любую скорость или затраты памяти из Mylyn критической ошибкой. Пожалуйста, отправьте отчет об ошибке: http://eclipse.org/mylyn/support/

Если вы хотите ускорить запуск без удаления Mylyn, так как удаление плагинов в Eclipse может будьте утомительными, откройте «Окно» -> «Настройки» -> «Общие» -> «Запуск и завершение» и снимите флажки с функций Mylyn.

5
задан splattne 27 November 2010 в 16:01
поделиться

3 ответа

A. Получите ASIHTTPRequest .

B. Получите json-framework .

C. Используйте A для получения данных от вашего веб-сервиса, а затем передайте их B, который возвращает словарь.

Это почти все.

11
ответ дан 18 December 2019 в 13:16
поделиться

To use JSON, you need to use a 3rd party framework, as there is no built-in support. I suggest using this http://code.google.com/p/json-framework/ as it's one of the simplest to implement. You can make the GET request just using NSURLRequest, or I'd also recommend using http://allseeing-i.com/ASIHTTPRequest/ if you need to make more complex requests, for example using basic authentication.

I wrote a blog post that has step-by-step instructions on using JSON from Cocoa/Objective-C with an example:

http://zachwaugh.com/2009/01/how-to-use-json-in-cocoaobjective-c/

2
ответ дан 18 December 2019 в 13:16
поделиться

There are a few ways to do this ill mention 2

1- If you are getting just some text response back you can use [NSString stringWithContentOfURL:url] this will fill the string with the response of the web request.

2- You can use NSURLRequest/NSMutableURLRequest along with NSURLConnection to make your request and get the data back, heres a ref to NSURLRequest http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/Reference/Reference.html, youll have to set a few properties such as the URL the request type (get, post) httpHeaders if applicable, once you have done that you can use NSURLConnection to issue the request heres a reference, http://developer.apple.com/iphone/library/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html, you can use methods such as sendSynchronousRequest or initWithRequest and start (to do an async request) which will get you your response (both cases youll get some NSData o bject back which you can translate into whatever it is its supose to be (a string or some picture data or whatever).

This question has been posted a few times in SO, just look around im sure ull find good examples, heres one link Can I make POST or GET requests from an iphone application?.

Also there is a json framework out there that will parse t he JSON responses for you, heres a link talking about that http://iphone.zcentric.com/2008/08/05/install-jsonframewor/

1
ответ дан 18 December 2019 в 13:16
поделиться