{"id":267377,"date":"2015-11-03T12:03:03","date_gmt":"2015-11-03T09:03:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=267377"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=267377","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"},"content":{"rendered":"<p>       <i>\u042d\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \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>. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u043d\u0438\u0433\u0438, \u0432\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0434\u0435\u043b\u0430\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0431\u0440\u0430\u043d \u0442\u0435\u043a\u0441\u0442, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432 storyboard. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 Portrait \u0438 \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 iPhone.<\/i><\/p>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 Label \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0448\u0443\u0442\u043a\u0430 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u0447\u0435\u0440\u0435\u0437 API \u0441\u0430\u0439\u0442\u0430 <a href=\"http:\/\/api.icndb.com\/jokes\/random\">api.icndb.com\/jokes\/random<\/a> \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/956\/953\/66e\/95695366e2a6452b89b8d1a9d6d23cfe.png\"\/><br \/>  <i>\u0420\u0438\u0441.1 \u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0448\u0443\u0442\u043a\u0443 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435.<\/i><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e NSURLSession<\/h4>\n<p>  <\/p>\n<h5>\u0422\u0435\u043e\u0440\u0438\u044f \u043f\u043e HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0443<\/h5>\n<p>  \u041d\u0430\u043f\u043e\u043c\u043d\u0438\u043c \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 HTTP \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u041f\u0443\u0441\u0442\u044c \u043c\u044b \u043f\u0435\u0447\u0430\u0442\u0430\u0435\u043c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 URL: <code>http:\/\/google.com\/?q=Hello&safe=off<\/code>.<\/p>\n<p>  \u0412 \u043d\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ul>\n<li>http \u2013 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c HTTP \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435<\/li>\n<li>:\/\/ \u043e\u0442\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u0442 \u0434\u043e\u043c\u0435\u043d\u0430<\/li>\n<li>google.com \u2013 \u0434\u043e\u043c\u0435\u043d, \u043e\u0442\u043a\u0443\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/li>\n<li>\/ \u2014 \u043f\u0443\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c\u043e\u0433\u043e \u043d\u0430\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430<\/li>\n<li>? \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430<\/li>\n<li>q=Hello&#038;safe=off \u2013 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b. \u041a\u0430\u0436\u0434\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043f\u0430\u0440\u044b \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041a\u043b\u044e\u0447 q \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Hello, \u043a\u043b\u044e\u0447 safe \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 off<\/li>\n<\/ul>\n<p>  \u041f\u0440\u0438 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434. \u041c\u0435\u0442\u043e\u0434 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u0447\u0442\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u0441\u043b\u0430\u043d\u043d\u043e\u0439 \u043d\u0430\u043c\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439. <\/p>\n<p>  \u0412\u043a\u0440\u0430\u0442\u0446\u0435, \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u0441 google.com \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 GET \u0437\u0430\u043f\u0440\u043e\u0441, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 HTTP \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443, \u043d\u0430 \u043a\u043e\u0440\u043d\u0435\u0432\u0443\u044e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \/, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 q=Hello&#038;safe=off.<\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0440\u0430\u0441\u043f\u0430\u0440\u0441\u0438\u0442 URL, \u0442\u043e HTTP \u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">GET \/?q=Hello&safe=off HTTP\/1.1 Host: google.com Content-Length: 133 (\u2026) <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u0442\u0440\u043e\u043a ASCII \u0442\u0435\u043a\u0441\u0442\u0430. \u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 GET \u043c\u0435\u0442\u043e\u0434, \u0437\u0430 \u043d\u0438\u043c \u043f\u0443\u0442\u044c \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0437\u0430\u0442\u0435\u043c HTTP \u0432\u0435\u0440\u0441\u0438\u044f. \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u0434\u0435\u0442\u0430\u043b\u0438 \u0442\u0430\u043a\u0438\u0435, \u043a\u0430\u043a \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0445\u043e\u0441\u0442 \u0438 \u0434\u043b\u0438\u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043e\u0442\u0434\u0435\u043b\u0435\u043d \u043e\u0442 \u0442\u0435\u043b\u0430 \u0434\u0432\u0443\u043c\u044f \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438. \u0414\u043b\u044f GET \u0442\u0435\u043b\u043e \u043f\u0443\u0441\u0442\u043e\u0435.<\/p>\n<p>  \u0420\u0438\u0441.2 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441, \u043f\u043e\u0442\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043a \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0435\u0442\u0438, \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0434\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0447\u0430\u0441\u044b \u0438 \u0434\u0430\u0436\u0435 \u0434\u043d\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/816\/0c0\/f52\/8160c0f5207e4cc89a98c2013dc6a4a4.png\"\/><br \/>  <i>\u0420\u0438\u0441.2 \u0428\u0430\u0433\u0438 \u0432 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0435:(a) \u043e\u0431\u044b\u0447\u043d\u043e\u0435 HTTP \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0438 (b) \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f Objective-C \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/i><\/p>\n<h5>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c Empty Application \u0432 Xcode \u0438 \u0432 \u043d\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b:<\/p>\n<p>  THSAppDelegate.h<\/p>\n<pre><code class=\"objectivec\">#import &lt;UIKit\/UIKit.h&gt;  @class THSViewController;  @interface THSAppDelegate : UIResponder &lt;UIApplicationDelegate&gt;  @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) THSViewController *viewController;  @end <\/code><\/pre>\n<p>  THSAppDelegate.m<\/p>\n<pre><code class=\"objectivec\">#import &quot;THSAppDelegate.h&quot; #import &quot;THSViewController.h&quot;  @implementation THSAppDelegate  - (BOOL)          application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];     self.viewController = [[THSViewController alloc] initWithNibName:nil bundle:nil];     self.window.rootViewController = self.viewController;     self.window.backgroundColor = [UIColor whiteColor];      [self.window makeKeyAndVisible];     return YES; }  @end <\/code><\/pre>\n<p>  THSViewController.h<\/p>\n<pre><code class=\"objectivec\">#import &lt;UIKit\/UIKit.h&gt;  @interface THSViewController : UIViewController  @property (nonatomic, strong) UILabel *jokeLabel;  @end <\/code><\/pre>\n<p>  THSViewController.m<\/p>\n<pre><code class=\"objectivec\">#import &quot;THSViewController.h&quot; #import &quot;THSViewController+Interface.h&quot;  @implementation THSViewController - (void)viewDidLoad {     [super viewDidLoad];      [self addLabel]; }  @end <\/code><\/pre>\n<p>  THSViewController+Interface.h<\/p>\n<pre><code class=\"objectivec\">#import &quot;THSViewController.h&quot;  @interface THSViewController (Interface)  - (void)addLabel;  @end <\/code><\/pre>\n<p>  THSViewController+Interface.m<\/p>\n<pre><code class=\"objectivec\">#import &quot;THSViewController+Interface.h&quot;  @implementation THSViewController (Interface)  - (void)addLabel {     CGFloat width = self.view.frame.size.width - 40.0f;     CGFloat y = self.view.frame.size.height \/ 2.0f - 200.0f;     CGRect labelFrame = CGRectMake(20.0f, y, width, 200.0f);     self.jokeLabel = [[UILabel alloc] initWithFrame:labelFrame];     self.jokeLabel.text = @&quot;Quotation goes here and continues and continues until I am fed up to type.&quot;;     self.jokeLabel.lineBreakMode = NSLineBreakByWordWrapping;     self.jokeLabel.textAlignment = NSTextAlignmentCenter;     self.jokeLabel.numberOfLines = 0;     self.jokeLabel.font = [UIFont systemFontOfSize:16.0f];      [self.view addSubview:self.jokeLabel]; }  @end <\/code><\/pre>\n<p>  \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u043e \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0433\u043b\u0430\u0432\u044b \u0441 \u043a\u043e\u0434\u043e\u043c \u043b\u044d\u0439\u0431\u043b\u044b \u0438 \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043a\u043d\u043e\u043f\u043e\u043a.<\/p>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \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:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/034\/92d\/f34\/03492df34ba34c11bf00ed236a678829.png\"\/><br \/>  <i>\u0420\u0438\u0441.3 \u0421\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/i><\/p>\n<h5>C\u043e\u0437\u0434\u0430\u0435\u043c Cocoa \u043a\u043b\u0430\u0441\u0441 THSHTTPCommunication<\/h5>\n<p>  \u0412\u0441\u0435 UI \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435. \u0415\u0441\u043b\u0438 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a, \u0442\u043e \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u043e \u043a\u0430\u0441\u0430\u043d\u0438\u044e, \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f, \u0437\u0432\u0443\u043a\u0438, \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u043d\u0435\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0440\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0442\u0435\u0445\u043d\u0438\u043a\u0438: \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0432\u0443\u043c\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u043c\u0438 \u0438\u043b\u0438 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a \u0434\u0435\u043b\u0435\u0433\u0430\u0442 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0435 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u0430.<\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0432 Cocoa \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u043f\u0440\u043e\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043a\u0430\u043a \u0434\u0435\u043b\u0435\u0433\u0430\u0442-\u043f\u0430\u0442\u0442\u0435\u0440\u043d, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u044e\u0449\u0438\u0435 \u0432\u0440\u0435\u043c\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d.<\/p>\n<p>  \u0421 iOS 5 Objective-C \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0431\u043b\u043e\u043a\u0438. <\/p>\n<p>  <i>\u041c\u044b \u0431\u0443\u0434\u0435\u043c \u044e\u0437\u0430\u0442\u044c \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u043e \u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u0432 iOS7 \u0435\u0441\u0442\u044c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0430\u0445\u0430\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0431\u043b\u043e\u043a\u0438 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432.<\/i> <\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441 THSHTTPCommunication. <\/p>\n<p>  THSHTTPCommunication.h:<\/p>\n<pre><code class=\"objectivec\">#import &lt;Foundation\/Foundation.h&gt;  @interface THSHTTPCommunication : NSObject  @end <\/code><\/pre>\n<p>  THSHTTPCommunication.m:<\/p>\n<pre><code class=\"objectivec\">#import &quot;THSHTTPCommunication.h&quot;  @interface THSHTTPCommunication ()  @property(nonatomic, copy) void(^successBlock)(NSData *);  @end  @implementation THSHTTPCommunication  @end <\/code><\/pre>\n<p>  \u0433\u0434\u0435 successBlock \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f.<\/p>\n<h5>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c HTTP \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435<\/h5>\n<p>  \u0414\u0430\u043b\u044c\u0448\u0435, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 \u0432 THSHTTPCommunication.m, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430 HTTP \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0432\u044b\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0448\u0443\u0442\u043a\u0438 \u0441 \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u043e\u0433\u043e API, \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e icndb, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u043b\u043e\u043a\u043e\u0432.<\/p>\n<p>  THSHTTPCommunication.m:<\/p>\n<pre><code class=\"objectivec\">@implementation THSHTTPCommunication  - (void)retrieveURL:(NSURL *)url successBlock:(void(^)(NSData *))successBlock {     \/\/ \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 successBlock \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u043e\u0437\u0436\u0435     self.successBlock = successBlock;      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0430\u043d\u043d\u044b\u0439 url     NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];      \/\/ \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0435\u0441\u0441\u0438\u044e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044f \u043d\u0430\u0448 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a \u0434\u0435\u043b\u0435\u0433\u0430\u0442     NSURLSessionConfiguration *conf =         [NSURLSessionConfiguration defaultSessionConfiguration];     NSURLSession *session = [NSURLSession sessionWithConfiguration:conf delegate:self delegateQueue:nil];      \/\/ \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443     NSURLSessionDownloadTask *task = [session downloadTaskWithRequest:request];      \/\/ \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435     [task resume]; }  @end <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0434\u0432\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430: URL, \u043e\u0442\u043a\u0443\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e icndb API URL \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0448\u0443\u0442\u043e\u043a) \u0438 \u0431\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u0432\u0430\u043d \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u043b\u043e\u043a \u0434\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043f\u043e\u0437\u0436\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c\u0441\u044f. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0448\u0430\u0433 \u2013 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 NSURLRequst \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e URL \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. [task resume] \u043d\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c warning, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u0441\u043e\u043e\u0431\u0449\u0438\u043b\u0438, \u0447\u0442\u043e THSHTTPCommunication \u043a\u043b\u0430\u0441\u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 NSURLSessionDownloadDelegate \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443. \u042d\u0442\u0438\u043c \u0438 \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0434\u0430\u043b\u0435\u0435. <\/p>\n<h5>\u0414\u0435\u043b\u0435\u0433\u0430\u0442 \u0441\u0435\u0441\u0441\u0438\u0438<\/h5>\n<p>  \u041c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c NSURLSessionDownloadDelegate \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043a\u0430\u043a \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u043e\u0431\u0449\u0438\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0443, \u0447\u0442\u043e THSHTTPCommunication \u043f\u043e\u0434\u0447\u0438\u043d\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443.<\/p>\n<p>  THSHTTPCommunication.h:<\/p>\n<pre><code class=\"objectivec\">@interface THSHTTPCommunication : NSObject&lt;NSURLSessionDownloadDelegate&gt;  @end <\/code><\/pre>\n<p>  <i>NSURLSessionDownloadDelegate<\/i> \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 NSURLConnection \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 HTTP \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <i>URLSession:downloadTask:didFinishDownloadingToURL:<\/i><\/p>\n<p>  \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u0430\u043a \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441. \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u0441\u0430\u043c\u0438 \u0437\u0430 \u0441\u0435\u0431\u044f:<\/p>\n<p>  <i>URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:<br \/>  URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:<\/i><\/p>\n<p>  \u041d\u043e \u044d\u0442\u043e \u043d\u0435 \u0432\u0441\u0435. \u0412\u0434\u043e\u0431\u0430\u0432\u043e\u043a NSURLSession API \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0440\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u044d\u0442\u043e:<\/p>\n<p>  <i>NSURLSessionDelegate<\/i> \u2014 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b-\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0443\u0440\u043e\u0432\u043d\u044f \u0441\u0435\u0441\u0441\u0438\u0439, \u043a\u0430\u043a \u0430\u043d\u043d\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0438 \u0438\u043b\u0438 \u043f\u043e\u043b\u043d\u043e\u043c\u043e\u0447\u0438\u0439.<br \/>  <i>NSURLSessionTaskDelegate<\/i> \u2014 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b-\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u044b, \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445.<br \/>  <i>NSURLSessionDataDelegate<\/i> \u2014 \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b-\u0434\u0435\u043b\u0435\u0433\u0430\u0442\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0443\u0440\u043e\u0432\u043d\u044f \u0437\u0430\u0434\u0430\u0447, \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0445 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0437\u0430\u0434\u0430\u0447 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<h5>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430<\/h5>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430 \u0432 THSHTTPCommunication.m. NSURLSession \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u043d\u0443\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>  THSHTTPCommunication.m:<\/p>\n<pre><code class=\"objectivec\">@implementation THSHTTPCommunication  \u2026  - (void) URLSession:(NSURLSession *)session        downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {     \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430     NSData *data = [NSData dataWithContentsOfURL:location];      \/\/ \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u043c, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 successBlock \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435     dispatch_async(dispatch_get_main_queue(), ^{         \/\/ \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u0431\u043b\u043e\u043a \u043a\u0430\u043a \u043a\u043e\u043b\u0431\u044d\u043a         self.successBlock(data);     }); } @end <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u2013 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0430\u0433 \u0432\u043e \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438. \u041c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c \u0431\u043b\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0417\u0430\u043c\u0435\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430 NSURL, \u043d\u043e \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 URL \u2013 \u044d\u0442\u043e \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0436\u0430\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430, \u0430 \u043d\u0435 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 URL.<\/p>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u043c\u0438, \u0447\u0442\u043e \u0432\u044b\u0437\u043e\u0432 successBlock \u043a\u043e\u043b\u0431\u044d\u043a\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430. \u042d\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u043e\u0439, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u0442\u043e\u0434, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441, \u0434\u0435\u043b\u0430\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u0443\u044e \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a UI \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f. <\/p>\n<p>  \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442\u044c \u043f\u0443\u043d\u043a\u0442 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0420\u0438\u0441.4 \u041c\u044b \u043f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u0443\u044e \u043d\u0430 <code>http:\/\/t.co\/<\/code>, \u043d\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u2013 \u044d\u0442\u043e \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443. \u041d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 (\u0441\u0430\u043c\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430).<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/871\/5f6\/a33\/8715f6a3319246b58095786a31cd970d.png\"\/><br \/>  <i>\u0420\u0438\u0441.4 \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u043f\u043e \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u043e\u043c\u0443 Twitter url \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442.<\/i><\/p>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0432 NSURLSessionTaskDelegate, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c NSURLSession \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438, \u0447\u0442\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>  \u0414\u0435\u043b\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 retrieveURL:successBlock: \u0434\u043b\u044f \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u043c THSHTTPCommunication.h \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u044e \u043c\u0435\u0442\u043e\u0434\u0430:<\/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;  @end <\/code><\/pre>\n<p>  <\/p>\n<h4>\u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438<\/h4>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b\u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0448\u0443\u0442\u043a\u0438 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 icndb.com. \u042d\u0442\u043e\u0442 API \u043a\u0430\u043a \u0438 \u0432\u0441\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u043c\u0438 \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438, \u0438\u043c\u0435\u044e\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432\u043e \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438. \u0414\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u044b Objective-C.<\/p>\n<h5>\u0421\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h5>\n<p>  \u0420\u0438\u0441.5 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0412\u0438\u0434\u0438\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u0435\u043b\u044c (icndb \u0441\u0435\u0440\u0432\u0435\u0440) \u0441\u043b\u0435\u0432\u0430 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044c (\u043a\u043b\u0438\u0435\u043d\u0442) \u0441\u043f\u0440\u0430\u0432\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0448\u0443\u0442\u043a\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f, icndb \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0435 \u043a\u0430\u043a \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0432 \u0432\u0438\u0434\u0435 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043f\u0430\u043c\u044f\u0442\u0438, \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0438\u0434 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430). \u041a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0448\u0443\u0442\u043a\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043c (\u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044e). \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0441\u0438\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 Objective-C \u043e\u0431\u044a\u0435\u043a\u0442\u044b.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b01\/afd\/90a\/b01afd90a73e4bedb49fd19107e998a1.png\"\/><br \/>  <i>\u0420\u0438\u0441.5 \u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/i><\/p>\n<p>  \u0415\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043e\u0431\u043c\u0435\u043d\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439, \u043d\u043e \u043c\u044b \u0441\u043e\u0441\u0440\u0435\u0434\u043e\u0442\u043e\u0447\u0438\u043c\u0441\u044f \u043d\u0430 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0448\u0438\u0440\u043e\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438: JavaScript Object Notation ( JSON ). JSON \u2013 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435. JSON \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u043f\u0440\u0430\u0432\u0438\u043b \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u043e\u043a, \u0447\u0438\u0441\u0435\u043b \u0438 \u0431\u0443\u043b\u0435\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0412\u043c\u0435\u0441\u0442\u0435 \u0441 XML \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440 JSON \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438:<\/p>\n<pre><code class=\"xml\">{ &quot;name&quot;: &quot;Martin Conte Mac Donell&quot;, &quot;age&quot;: 29, &quot;username&quot;: &quot;fz&quot; } <\/code><\/pre>\n<p>  \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043b\u043e\u0432\u0430\u0440\u044c, \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u0432 {} \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0438\u0437 \u043f\u0430\u0440 \u043a\u043b\u044e\u0447\/\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041a\u043b\u044e\u0447\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 name, age \u0438 username \u2013 \u043a\u043b\u044e\u0447\u0438, Martin Conte Mac Donell, 29 \u0438 fz \u2013 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/p>\n<h5>\u041a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0448\u0443\u0442\u043e\u043a<\/h5>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e JSON \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0438 \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e. \u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0448\u0443\u0442\u043e\u043a. \u0412 THSViewController.m \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u044e\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e jokeID \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u0443\u044e \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044e \u0438 \u043c\u0435\u0442\u043e\u0434 retrieveRandomJokes.<\/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;  @interface THSViewController () {     NSNumber *jokeID; }  @end  @implementation THSViewController  ...  - (void)retrieveRandomJokes {     THSHTTPCommunication *http = [[THSHTTPCommunication alloc] init];     NSURL *url = [NSURL URLWithString:@&quot;http:\/\/api.icndb.com\/jokes\/random&quot;];      \/\/ \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0448\u0443\u0442\u043a\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 THSHTTPCommunication     [http retrieveURL:url successBlock:^(NSData *response)     {         NSError *error = nil;          \/\/ \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e         NSDictionary *data = [NSJSONSerialization JSONObjectWithData:response                                                              options:0                                                                error:&error];         if (!error)         {             NSDictionary *value = data[@&quot;value&quot;];             if (value && value[@&quot;joke&quot;])             {                 jokeID = value[@&quot;id&quot;];                 [self.jokeLabel setText:value[@&quot;joke&quot;]];             }         }     }]; }  @end <\/code><\/pre>\n<p>  \u041c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0442\u043e\u0434 retrieveRandomJokes \u0438 \u0432\u0438\u0434\u0438\u043c, \u043a\u0430\u043a \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043a\u043e\u0434\u0430. \u0412 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u043d\u0435\u0435 \u043a\u043b\u0430\u0441\u0441 THSHTTPCommunication \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 icndb.com. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0440\u0430\u0437\u0443 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043a\u043b\u0430\u0441\u0441\u0430 THSHTTPCommunication \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c retrieveURL:successBlock:, \u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e THSHTTPCommunication \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 icndb.com, \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0431\u043b\u043e\u043a\u0430, \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430. \u0412 \u044d\u0442\u043e\u0439 \u0442\u043e\u0447\u043a\u0435 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043a \u0440\u0430\u0437\u0431\u043e\u0440\u0443.<\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430, \u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c. \u041d\u0443\u0436\u0435\u043d \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u043e \u0447\u0442\u043e-\u0442\u043e, \u0441 \u0447\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0412\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0448\u0443\u0442\u043a\u0443 \u0438 id \u0438\u0437 \u043e\u0442\u0432\u0435\u0442\u0430. \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 (JSON) \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 iOS 5 Cocoa framework \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 JSON. \u042d\u0442\u043e NSJSONSerialization \u043a\u043b\u0430\u0441\u0441, \u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e\u0442\u0432\u0435\u0442\u0430 \u2013 \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0432 \u0431\u043b\u043e\u043a\u0435.<\/p>\n<p>  \u041e\u0442\u0432\u0435\u0442 \u043e\u0442 icndb API \u2013 \u044d\u0442\u043e \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0441 JSON \u043a\u0430\u043a<\/p>\n<pre><code class=\"xml\">{ &quot;type&quot;: &quot;success&quot;, &quot;value&quot;:    {    &quot;id&quot;: 201,    &quot;joke&quot;: &quot;Chuck Norris was what Willis was talkin\u2019 about&quot;    } } <\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u043c, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438 \u043a\u043b\u044e\u0447 \u201cvalue\u201d \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e NSJSONSerialization \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 JSON \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u0432 Objective-C NSDictionaries, \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0432 NSArray, \u0447\u0438\u0441\u043b\u0430 \u0432 NSNumber, \u0430 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 NSString. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044f\u0441\u044c \u043a retrieveRandomJokes:, \u043f\u043e\u0441\u043b\u0435 \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 \u043a\u043b\u044e\u0447\u0430 \u201cvalue\u201d \u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044e NSDictionary. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0448\u0443\u0442\u043a\u0438 \u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u043b\u044d\u0439\u0431\u043b\u044b \u0432 \u043d\u0430\u0448\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435.<\/p>\n<p>  \u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0432\u044b\u0437\u0432\u0430\u0442\u044c retrieveRandomJokes: \u043c\u0435\u0442\u043e\u0434, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0430\u0441\u044c \u0432\u044c\u044e\u0445\u0430.<\/p>\n<p>  THSViewController.m:<\/p>\n<pre><code class=\"objectivec\">- (void)viewDidLoad {     [super viewDidLoad];      [self addLabel];      [self retrieveRandomJokes]; } <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0435, \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0443\u0432\u0438\u0434\u0438\u043c \u043d\u043e\u0432\u0443\u044e \u0448\u0443\u0442\u043a\u0443 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435.       <\/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\/270049\/\"> http:\/\/habrahabr.ru\/post\/270049\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <i>\u042d\u0442\u043e \u0430\u0432\u0442\u043e\u0440\u0441\u043a\u0438\u0439 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \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>. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u043d\u0438\u0433\u0438, \u0432\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441\u0434\u0435\u043b\u0430\u043d \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0443\u0431\u0440\u0430\u043d \u0442\u0435\u043a\u0441\u0442, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0439, \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0432 storyboard. \u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0432\u044b\u0431\u0440\u0430\u043d\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043a\u0440\u0430\u043d\u0430 Portrait \u0438 \u0446\u0435\u043b\u0435\u0432\u0430\u044f \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430 iPhone.<\/i><\/p>\n<p>  \u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 Label \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0448\u0443\u0442\u043a\u0430 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u0430\u044f \u0447\u0435\u0440\u0435\u0437 API \u0441\u0430\u0439\u0442\u0430 <a href=\"http:\/\/api.icndb.com\/jokes\/random\">api.icndb.com\/jokes\/random<\/a> \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/956\/953\/66e\/95695366e2a6452b89b8d1a9d6d23cfe.png\"\/><br \/>  <i>\u0420\u0438\u0441.1 \u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0448\u0443\u0442\u043a\u0443 \u043e \u0427\u0430\u043a\u0435 \u041d\u043e\u0440\u0440\u0438\u0441\u0435.<\/i>  <\/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-267377","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267377","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=267377"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/267377\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=267377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=267377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=267377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}