{"id":267725,"date":"2015-11-08T18:09:03","date_gmt":"2015-11-08T15:09:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=267725"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=267725","title":{"rendered":"\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 iOS. \u0427\u0430\u0441\u0442\u044c 2"},"content":{"rendered":"<p>       <i>\u042d\u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/270049\/\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0433\u043b\u0430\u0432\u044b 6 <b>Retrieving remote data<\/b> \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 <a href=\"https:\/\/www.manning.com\/books\/ios-7-in-action\">iOS7 in Action<\/a>.<\/i><\/p>\n<h4>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/h4>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434 GET, \u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:  <\/p>\n<ul>\n<li>POST<\/li>\n<li>PUT<\/li>\n<li>DELETE<\/li>\n<li>OPTIONS<\/li>\n<li>HEAD<\/li>\n<li>TRACE<\/li>\n<li>CONNECT<\/li>\n<\/ul>\n<p>  \u041c\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u0434\u0432\u0443\u0445 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445: GET \u0438 POST.<\/p>\n<p>  GET \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 URL. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435\u0439, \u0440\u0438\u0441\u0443\u043d\u043a\u043e\u043c \u0438\u043b\u0438 \u0430\u0443\u0434\u0438\u043e-\u0444\u0430\u0439\u043b\u043e\u043c. \u041f\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044e, GET \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 W3C \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0445, \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043e\u0442\u0441\u044b\u043b\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u044b \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 (\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 POST).<\/p>\n<p>  POST \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 URL. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u043e\u0442 \u0436\u0435 \u0444\u043e\u0440\u043c\u0430\u0442, \u0447\u0442\u043e \u0438 GET. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u043e\u0441\u0442\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u044e\u0449\u0443\u044e \u0434\u0432\u0430 \u043f\u043e\u043b\u044f, \u0438\u043c\u044f \u0438 \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0442\u043e \u043c\u044b \u043f\u043e\u0448\u043b\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 name=Martin&#038;age=29 \u0432 \u0442\u0435\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. <\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u2013 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u044b. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0438 \u043a\u043b\u0438\u043a\u0430\u0435\u043c Submit, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 POST.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u043d\u0438\u0439. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c POST \u0434\u043b\u044f \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0430 \u0448\u0443\u0442\u043e\u043a. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0433\u043e\u043b\u043e\u0441\u0430 (\u0438\u043b\u0438 +1 \u0438\u043b\u0438 -1) \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. <\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0438 \u0434\u043b\u044f \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u044f voteUp \u0438 voteDown, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u043d\u0438\u0436\u0430\u0442\u044c \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0448\u0443\u0442\u043a\u0438. \u0422\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u201cChuck Who?\u201d, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u043e web view. \u0412 THSViewController+Interface.h \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  THSViewController+Interface.h  <\/p>\n<pre><code class=\"objectivec\">#import &quot;THSViewController.h&quot;  @interface THSViewController (Interface)  - (void)addLabel; - (void)addButtonVoteUp; - (void)addButtonVoteDown; - (void)addButtonChuckWho;  @end <\/code><\/pre>\n<p>  \u0412 THSViewController+Interface.m \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<p>  THSViewController+Interface.m  <\/p>\n<pre><code class=\"objectivec\">- (void) addButtonVoteUp {     UIButton *voteUpButton = [UIButton buttonWithType:UIButtonTypeSystem];     [voteUpButton setTitle:@&quot;Vote Up&quot; forState:UIControlStateNormal];     CGFloat x = self.view.frame.size.width \/ 2.0 - 50.0f;     CGFloat y = self.view.frame.size.height \/ 2.0 + 0.0f;     voteUpButton.frame = CGRectMake(x, y, 100.0f, 50.0f);      [voteUpButton addTarget:self                      action:@selector(voteUp)            forControlEvents:UIControlEventTouchUpInside];      [self.view addSubview:voteUpButton]; }  -(void) addButtonVoteDown {     UIButton *voteDownButton = [UIButton buttonWithType:UIButtonTypeSystem];     [voteDownButton setTitle:@&quot;Vote Down&quot; forState:UIControlStateNormal];     CGFloat x = self.view.frame.size.width \/ 2.0 - 50.0f;     CGFloat y = self.view.frame.size.height \/ 2.0 + 50.0f;     voteDownButton.frame = CGRectMake(x, y, 100.0f, 50.0f);      [voteDownButton addTarget:self                      action:@selector(voteDown)            forControlEvents:UIControlEventTouchUpInside];      [self.view addSubview:voteDownButton]; }  - (void)addButtonChuckWho {     UIButton *chuckWhoButton = [UIButton buttonWithType:UIButtonTypeSystem];     [chuckWhoButton setTitle:@&quot;Chuck Who?&quot; forState:UIControlStateNormal];     CGFloat x = self.view.frame.size.width \/ 2.0 - 50.0f;     CGFloat y = self.view.frame.size.height \/ 2.0 + 150.0f;     chuckWhoButton.frame = CGRectMake(x, y, 100.0f, 50.0f);      [chuckWhoButton addTarget:self                      action:@selector(chuckWho)            forControlEvents:UIControlEventTouchUpInside];      [self.view addSubview:chuckWhoButton]; } <\/code><\/pre>\n<p>  \u0412 THSViewController.h \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0438 \u044d\u043a\u0448\u0435\u043d\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u043a\u043d\u043e\u043f\u043e\u043a. voteUp \u0434\u043b\u044f addButtonVoteUp, voteDown \u0434\u043b\u044f addButtonVoteDown \u0438 chuckWho \u0434\u043b\u044f addButtonChuckWho.<\/p>\n<p>  THSViewController.h  <\/p>\n<pre><code class=\"objectivec\">#import &lt;UIKit\/UIKit.h&gt;  @interface THSViewController : UIViewController  @property (nonatomic, strong) UILabel *jokeLabel;  - (void)voteUp; - (void)voteDown; - (void)chuckWho;  @end <\/code><\/pre>\n<p>  \u0412 THSViewController.m \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0430\u0431\u044b \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432.<\/p>\n<p>  THSViewController.m  <\/p>\n<pre><code class=\"objectivec\">- (void)voteUp {  }  - (void)voteDown {  }  - (void)chuckWho {   } <\/code><\/pre>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 viewDidLoad \u043c\u0435\u0442\u043e\u0434\u0435 THSViewController.m \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u044b, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0448 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. <\/p>\n<p>  THSViewController.m  <\/p>\n<pre><code class=\"objectivec\">- (void)viewDidLoad {     [super viewDidLoad];      [self addLabel];     [self addButtonVoteUp];     [self addButtonVoteDown];    [self addButtonChuckWho];      [self retrieveRandomJokes]; } <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u0438\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u0430\u043a \u043d\u0430 \u0420\u0438\u0441. 1<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/83c\/aa4\/2fd\/83caa42fdfcc4ee18765f7a431531472.png\"\/><br \/>  <i>\u0420\u0438\u0441.1 \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0434\u043b\u044f \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u044f<br \/>  <\/i><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f POST \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c \u0437\u0430 \u0432\u0441\u0435 \u043d\u0430\u0448\u0438 HTTP-\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438: THSHTTPCommunication \u043a\u043b\u0430\u0441\u0441. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 THSHTTPCommunication.m \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 postURL:params:successBlock, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0445\u043e\u0436 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 retrieveURL:successBlock \u043c\u0435\u0442\u043e\u0434.<\/p>\n<p>  THSHTTPCommunication.m  <\/p>\n<pre><code class=\"objectivec\">- (void)postURL:(NSURL *)url params:(NSDictionary *)params    successBlock:(void(^)(NSData *))successBlock {     self.successBlock = successBlock;      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f POST \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432     NSMutableArray *paramsArray = [NSMutableArray arrayWithCapacity:[params count]];      \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u043a\u0430\u043a key=value \u0441\u0442\u0440\u043e\u043a\u0443     for (NSString *key in params)     {         [paramsArray addObject:[NSString stringWithFormat:@&quot;%@=%@&quot;, key, params[key]]];     }      \/\/\u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c &     NSString *postBodyString = [paramsArray componentsJoinedByString:@&quot;&&quot;];      \/\/ \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c NSString \u0432 NSData \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435     NSData *postBodyData = [NSData dataWithBytes:[postBodyString UTF8String]                                           length:[postBodyString length]];      NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];     \/\/ \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 POST     [request setHTTPMethod:@&quot;POST&quot;];     \/\/ \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c content-type \u043a\u0430\u043a form encoded     [request setValue:@&quot;application\/x-www-form-urlencoded&quot;    forHTTPHeaderField:@&quot;content-type&quot;];     \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0430\u043d\u0435\u0435 POST \u0442\u0435\u043b\u043e \u0432 \u0437\u0430\u043f\u0440\u043e\u0441     [request setHTTPBody:postBodyData];      NSURLSessionConfiguration *conf = [NSURLSessionConfiguration defaultSessionConfiguration];     NSURLSession *session = [NSURLSession sessionWithConfiguration:conf delegate:self delegateQueue:nil];     NSURLSessionDownloadTask *task = [session downloadTaskWithRequest:request];      [task resume]; } <\/code><\/pre>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0431\u044b\u0447\u043d\u043e \u043e\u0442\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u043c\u0438 form-url-\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 W3C HTML \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c). \u042d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u0438 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445. \u041d\u0430\u0448 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c NSDictionary \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u043d\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043b\u0430\u0442\u044c \u043f\u043e HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e \u0441\u043b\u043e\u0432\u0430\u0440\u044c NSDictionary, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0442\u0438\u043f Objective-C. \u0414\u043b\u044f \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u043f\u043e HTTP-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044e \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430\u0440\u044f. \u042d\u0442\u043e \u043a\u0430\u043a \u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0441 \u0438\u043d\u043e\u0441\u0442\u0440\u0430\u043d\u0446\u0435\u043c. \u041c\u044b \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0448\u0435 \u043e\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043d\u0430 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0430 \u043e\u043d \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0441 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0443\u0436\u0435 \u043d\u0430 \u0441\u0432\u043e\u0439 \u0440\u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043d\u0430 \u0420\u0438\u0441. 2. \u0423\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0439\u0439 \u044f\u0437\u044b\u043a \u0432 HTTP \u2014 \u044d\u0442\u043e W3C \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442, \u043d\u0430\u0448 \u044f\u0437\u044b\u043a \u2014 \u044d\u0442\u043e Objective-C, \u044f\u0437\u044b\u043a \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f \u043d\u0430\u043c \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u0435\u043d.<\/p>\n<p>  W3C \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0435, \u0447\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0435\u043c\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 form-url-\u0437\u0430\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, param1=var1&#038;param2=var2).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b58\/130\/366\/b58130366b584b948a04a0ecf35e04c3.png\"\/><br \/>  <i>\u0420\u0438\u0441.2 \u041c\u0435\u0442\u0430\u0444\u043e\u0440\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/i><\/p>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043c\u0435\u0442\u043e\u0434\u0443 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435 \u0432 \u043a\u043e\u0434. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0432\u0441\u0435 \u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e &#038;. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 NSData, \u2014 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0448\u043b\u0435\u043c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u044f. \u0414\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 NSURLRequest, \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c HTTPMethod \u0432 POST \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 content-type.<\/p>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 THSViewController \u043a\u043b\u0430\u0441\u0441\u0435. <\/p>\n<p>  THSHTTPCommunication.h  <\/p>\n<pre><code class=\"objectivec\">@interface THSHTTPCommunication : NSObject &lt;NSURLSessionDownloadDelegate&gt;  - (void)retrieveURL:(NSURL *)url successBlock:(void(^)(NSData *))successBlock; - (void)postURL:(NSURL *)url params:(NSDictionary *)params    successBlock:(void(^)(NSData *))successBlock;  @end <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c THSHTTPCommunication \u043a\u043b\u0430\u0441\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f POST \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e THSViewController. \u041d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u043e\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u0440\u0435\u0439\u0442\u0438\u043d\u0433\u0430, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043b\u0438\u0441\u0442\u0438\u043d\u0433\u0435.<\/p>\n<p>  THSViewController.m  <\/p>\n<pre><code class=\"objectivec\">- (void)voteUp {     NSURL *url = [NSURL URLWithString:@&quot;http:\/\/example.com\/rater\/vote&quot;];     THSHTTPCommunication *http = [[THSHTTPCommunication alloc] init];     NSDictionary *params = @{@&quot;joke_id&quot;:jokeID, @&quot;vote&quot;:@(1)};     [http postURL:url params:params successBlock:^(NSData *response)      {          NSLog(@&quot;Voted Up&quot;);      }]; }  - (void)voteDown {     NSURL *url = [NSURL URLWithString:@&quot;http:\/\/example.com\/rater\/vote&quot;];     THSHTTPCommunication *http = [[THSHTTPCommunication alloc] init];     NSDictionary *params = @{@&quot;joke_id&quot;:jokeID, @&quot;vote&quot;:@(-1)};     [http postURL:url params:params successBlock:^(NSData *response)      {          NSLog(@&quot;Voted Down&quot;);      }];  } <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 NSURL \u0441 url, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 THSHTTPCommunication. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0414\u0435\u043b\u0430\u0435\u043c POST \u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043b\u0431\u044d\u043a successBlock.<\/p>\n<p>  \u042d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438 \u0434\u0440\u0443\u0433 \u043d\u0430 \u0434\u0440\u0443\u0433\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0439 URL, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438 \u0437\u0430\u0442\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 THSHTTPCommunication. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 GET \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u043c NSDictionary \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u041f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u0438\u0437\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, joke_id=&#038;vote=1), \u0447\u0442\u043e\u0431\u044b \u0441\u043c\u043e\u0447\u044c \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0445 \u0432 POST \u0437\u0430\u043f\u0440\u043e\u0441. \u041a\u0430\u043a \u043c\u044b \u0432\u0438\u0434\u0435\u043b\u0438 \u0440\u0430\u043d\u0435\u0435, \u043c\u0435\u0442\u043e\u0434, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430 \u044d\u0442\u0443 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, postURL:params:successBlock \u0438\u0437 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 THSHTTPCommunication. \u0418 \u0434\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0437\u044b\u0432\u0430\u044f \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u0437\u0430 \u0448\u0443\u0442\u043a\u0443 \u0438\u043b\u0438 \u043f\u0440\u043e\u0442\u0438\u0432 \u043d\u0435\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432\u044b\u0434\u0430\u044e\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f: <\/p>\n<p>  <code> 2015-11-08 14:51:20.724 Test[1248:80442] Voted Up <\/code><\/p>\n<p>  \u0438\u043b\u0438 <\/p>\n<p>  <code> 2015-11-08 14:51:57.896 Test[1273:81833] Voted Down <\/code><\/p>\n<p>  \u0447\u0442\u043e \u0441\u0432\u0438\u0434\u0435\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0443\u0435\u0442 \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u043c POST-\u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  \u041c\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0448\u0443\u0442\u043e\u043a \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c icndb API \u0438 GET HTTP \u0433\u043b\u0430\u0433\u043e\u043b\u0430. \u041c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u044d\u0442\u0438 \u0448\u0443\u0442\u043a\u0438 \u043d\u0430 UIView \u0438 \u043a\u0430\u0436\u0434\u0443\u044e \u0448\u0443\u0442\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0446\u0435\u043d\u0438\u0442\u044c. \u042d\u0442\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e\u0441\u044b\u043b\u0430\u044e\u0442 POST \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430\u0448\u0443 \u043e\u0446\u0435\u043d\u043a\u0443. <\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 web views \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/h4>\n<p>  \u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u0432\u0435\u0431-\u0431\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u041e\u0442\u043b\u0438\u0447\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u043c \u043e\u0442\u0432\u0435\u0442\u0430. \u0412\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e HTML \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0440\u044f\u0434 \u043f\u0440\u0430\u0432\u0438\u043b \u043d\u0430 \u0442\u043e, \u043a\u0430\u043a \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0435\u0433\u0438 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438. \u042d\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438, \u043d\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 W3C \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u2013 \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432 iOS \u0435\u0441\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 UIWebView, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0434\u0432\u0438\u0436\u043e\u043a WebKit \u0438 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442 HTML\/CSS\/JavaScript \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u0446\u0435\u043b\u044b\u0435 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432\u043d\u0443\u0442\u0440\u0438 UIView.<\/p>\n<p>  \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u041c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c webView \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430 \u0432\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435. \u041e\u043d\u0430 \u0437\u0430\u043f\u0443\u0442\u0438\u0442\u0441\u044f \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438. <\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 THSWebViewController, \u044f\u0432\u043b\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441\u043e\u043c UIViewController. <\/p>\n<p>  THSWebViewController.h  <\/p>\n<pre><code class=\"objectivec\">#import &lt;UIKit\/UIKit.h&gt;  @interface THSWebViewController : UIViewController  @property (nonatomic, strong) UIWebView *webView;  - (void)dismissView; \/\/ \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0448\u0443 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u044c\u044e\u0445\u0443 - (void)back;\t    \/\/ \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u043f\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u043d\u0430\u0437\u0430\u0434 - (void)forward;     \/\/ \u0438 \u0432\u043f\u0435\u0440\u0435\u0434  @end <\/code><\/pre>\n<p>  THSWebViewController.m  <\/p>\n<pre><code class=\"objectivec\">#import &quot;THSWebViewController.h&quot; #import &quot;THSWebViewController+Interface.h&quot;  @interface THSWebViewController ()  @end  @implementation THSWebViewController  - (void)viewDidLoad {     [super viewDidLoad];      [self addWebView];     [self addNavBar];     [self addTabBar]; }  - (void)dismissView {     \/\/ \u0441\u0442\u0430\u0431 }  - (void)back {     \/\/ \u0441\u0442\u0430\u0431 }  - (void)forward {     \/\/ \u0441\u0442\u0430\u0431 }  @end <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e THSWebViewController+Interface, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0432\u044b\u043d\u0435\u0441\u043b\u0438 \u043a\u043e\u0434 \u043f\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u0435\u0431-\u0432\u044c\u044e\u0445\u0438:<\/p>\n<p>  THSWebViewController+Interface.h  <\/p>\n<pre><code class=\"objectivec\">#import &quot;THSWebViewController.h&quot;  @interface THSWebViewController (Interface)  - (void)addWebView; - (void)addNavBar; - (void)addTabBar;  @end <\/code><\/pre>\n<p>  THSWebViewController+Interface.m  <\/p>\n<pre><code class=\"objectivec\">#import &quot;THSWebViewController+Interface.h&quot;  @implementation THSWebViewController (Interface)  - (void)addWebView {     self.webView = [[UIWebView alloc] initWithFrame:self.view.frame];     [self.view addSubview:self.webView]; }  - (void)addNavBar {     CGFloat width = self.view.frame.size.width;     CGRect frame = CGRectMake(0.0f, 0.0f, width, 64.0f);     UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:frame];      self.navigationItem.title = @&quot;Chuck Norris&quot;;     [navBar pushNavigationItem:self.navigationItem animated:NO];      self.navigationItem.leftBarButtonItem =     [[UIBarButtonItem alloc] initWithTitle:@&quot;Back&quot;                                      style:UIBarButtonItemStylePlain                                     target:self                                     action:@selector(dismissView)];      [self.view addSubview:navBar]; }  - (void)addTabBar {     CGFloat width = self.view.frame.size.width;     CGRect frame = CGRectMake(0.0f, self.view.frame.size.height - 44.0f, width, 44.0f);     UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:frame];      frame = CGRectMake(0.0f, 0.0f, 50.0f, 30.0f);     UIBarButtonItem *backBtn =     [[UIBarButtonItem alloc] initWithTitle:@&quot;&lt;&quot;                                      style:UIBarButtonItemStylePlain                                     target:self                                     action:@selector(back)];     UIBarButtonItem *forwardBtn =     [[UIBarButtonItem alloc] initWithTitle:@&quot;&gt;&quot;                                      style:UIBarButtonItemStylePlain                                     target:self                                     action:@selector(forward)];      [toolBar setItems:@[backBtn, forwardBtn]];      [self.view addSubview:toolBar]; }  @end <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 THSViewController.m \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430 chuckWho, \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. \u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c THSWebViewController.h \u0444\u0430\u0439\u043b.<\/p>\n<p>  THSViewController.m  <\/p>\n<pre><code class=\"objectivec\">#import &quot;THSViewController.h&quot; #import &quot;THSViewController+Interface.h&quot; #import &quot;THSHTTPCommunication.h&quot; #import &quot;THSWebViewController.h&quot;  \u2026  - (void)chuckWho {     THSWebViewController *webViewController = [[THSWebViewController alloc] init];      [self presentViewController:webViewController animated:YES completion:nil]; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 Chuck Who, \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u043f\u0443\u0441\u0442\u0443\u044e web view \u043a\u0430\u043a \u043d\u0430 \u0420\u0438\u0441.3.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/de6\/715\/502\/de67155022124434bce654e3e2914031.png\"\/><br \/>  <i>\u0420\u0438\u0441.3. \u041f\u0443\u0441\u0442\u0430\u044f web view \u0432 \u043c\u043e\u0434\u0430\u043b\u044c\u043d\u043e\u043c \u043e\u043a\u043d\u0435<\/i><\/p>\n<p>  \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 viewDidLoad \u043a\u043b\u0430\u0441\u0441\u0430 THSWebViewController \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434.<\/p>\n<p>  THSWebViewController.m  <\/p>\n<pre><code class=\"objectivec\">- (void)viewDidLoad {     [super viewDidLoad];      [self addWebView];     [self addNavBar];    [self addTabBar];      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442 NSURLRequest \u0441 URL \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435     NSURLRequest *request = [NSURLRequest requestWithURL:                              [NSURL URLWithString:@&quot;http:\/\/en.wikipedia.org\/wiki\/Chuck_Norris&quot;]];    \/\/ \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430 \u043a\u043b\u0430\u0441\u0441\u0430 webView     [self.webView loadRequest:request]; } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0438 \u0440\u0430\u043d\u0435\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 NSURLRequest, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NSURLSession, \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 loadRequest \u043a\u043b\u0430\u0441\u0441\u0430 UIWebView, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0437\u0430 \u043d\u0430\u0441.<\/p>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u0435\u0442\u043e\u0434\u043e\u0432 dismissView, back \u0438 forward. <\/p>\n<p>  THSWebViewController.m  <\/p>\n<pre><code class=\"objectivec\">- (void)dismissView { \t\/\/ \u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442 webView \u0441 \u044d\u043a\u0440\u0430\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u0437\u0432\u0430\u043d \u043c\u0435\u0442\u043e\u0434 close     [self dismissViewControllerAnimated:YES completion:nil]; }  - (void)back { \t\/\/ \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0443\u044e \u043b\u043e\u043a\u0430\u0446\u0438\u044e \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 back     [self.webView goBack]; }  - (void)forward { \t\/\/ \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043b\u043e\u043a\u0430\u0446\u0438\u044e \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0436\u0430\u0442\u0430 \u043a\u043d\u043e\u043f\u043a\u0430 forward     [self.webView goForward]; } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e, \u0432\u0430\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0449\u0435\u0439 \u043e UIWebView.<\/p>\n<p>  \u0415\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u043d\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u0438\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 URL \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d.<\/p>\n<p>  \u0418\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0434\u043b\u044f \u0434\u0435\u0442\u0435\u0439, \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043e\u0442 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0449\u0438\u0445 \u043f\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438, \u043a\u0430\u043a \u0441\u0435\u043a\u0441 \u0438\u043b\u0438 \u043d\u0430\u0440\u043a\u043e\u0442\u0438\u043a\u0438. \u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0430\u043a\u0438\u0445 \u0442\u0438\u043f\u043e\u0432 \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 UIWebViewDelegate \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430 UIWebView. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:<br \/>  <code> webView:shouldStartLoadWithRequest:navigationType: webViewDidStartLoad: webViewDidFinishLoad: webView:didFailLoadWithError: <\/code><\/p>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043a \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044f \u0438\u043b\u0438 \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044f \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u2013 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f (\u0438\u043c\u0435\u043d\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u0430\u0434\u0443\u0442 \u0432\u0430\u043c \u0445\u043e\u0440\u043e\u0448\u0435\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0438).<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435! \u0420\u0438\u0441. 4 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a web view \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442\u044c \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/cad\/a6d\/1af\/cada6d1af192483ebd103c96f0e09464.png\"\/><br \/>  <i>\u0420\u0438\u0441. 4. \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0438\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u043c\u0438 web view<\/i>               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/270429\/\"> http:\/\/habrahabr.ru\/post\/270429\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <i>\u042d\u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/270049\/\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u043c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0433\u043b\u0430\u0432\u044b 6 <b>Retrieving remote data<\/b> \u0438\u0437 \u043a\u043d\u0438\u0433\u0438 <a href=\"https:\/\/www.manning.com\/books\/ios-7-in-action\">iOS7 in Action<\/a>.<\/i><\/p>\n<h4>\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0435 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/h4>\n<p>  \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434 GET, \u043d\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b:  <\/p>\n<ul>\n<li>POST<\/li>\n<li>PUT<\/li>\n<li>DELETE<\/li>\n<li>OPTIONS<\/li>\n<li>HEAD<\/li>\n<li>TRACE<\/li>\n<li>CONNECT<\/li>\n<\/ul>\n<p>  \u041c\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u0434\u0432\u0443\u0445 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u0430\u0445: GET \u0438 POST.<\/p>\n<p>  GET \u2013 \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 URL. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435\u0439, \u0440\u0438\u0441\u0443\u043d\u043a\u043e\u043c \u0438\u043b\u0438 \u0430\u0443\u0434\u0438\u043e-\u0444\u0430\u0439\u043b\u043e\u043c. \u041f\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044e, GET \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 W3C \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043e\u043c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0445, \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c GET \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u043e\u0442\u0441\u044b\u043b\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u044b \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 (\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 POST).<\/p>\n<p>  POST \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043d\u0430 URL. \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u0432 \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u043e\u0442 \u0436\u0435 \u0444\u043e\u0440\u043c\u0430\u0442, \u0447\u0442\u043e \u0438 GET. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u043e\u0441\u0442\u0438\u0442\u044c \u0444\u043e\u0440\u043c\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u044e\u0449\u0443\u044e \u0434\u0432\u0430 \u043f\u043e\u043b\u044f, \u0438\u043c\u044f \u0438 \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0442\u043e \u043c\u044b \u043f\u043e\u0448\u043b\u0435\u043c \u0447\u0442\u043e-\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 name=Martin&#038;age=29 \u0432 \u0442\u0435\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. <\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u0445. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u2013 \u044d\u0442\u043e \u0444\u043e\u0440\u043c\u044b. \u041a\u043e\u0433\u0434\u0430 \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0444\u043e\u0440\u043c\u0443 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0438 \u043a\u043b\u0438\u043a\u0430\u0435\u043c Submit, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 POST.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-267725","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267725","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=267725"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267725\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}