{"id":225079,"date":"2014-06-04T08:42:02","date_gmt":"2014-06-04T04:42:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=225079"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=225079","title":{"rendered":"<span class=\"post_title\">\u041a\u0430\u043a \u0441\u043e\u0431\u0440\u0430\u0442\u044c WhatsApp \u0437\u0430 \u0441\u0443\u0442\u043a\u0438. \u0427\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d59\/e3c\/cb8\/d59e3ccb8b7fac27d79ae2d9e644848e.jpg\"\/><\/p>\n<p>  \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440\u0430!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 WhatsApp \u043f\u043e\u0434 iOS. \u0421\u0442\u0430\u0442\u044c\u044e \u0434\u0435\u043b\u044e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430:<\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 UI, \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/li>\n<li>\u0414\u0435\u043b\u0430\u0435\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 UI, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0438\u0434\u0435\u043e \u0438 \u0430\u0443\u0434\u0438\u043e \u0437\u0432\u043e\u043d\u043a\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0444\u043e\u0442\u043e \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/li>\n<\/ol>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u043e\u0441\u043e\u0431\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0431\u0440\u0430\u0442\u044c 400 000 000 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u0440\u043e\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0437\u0430 19 \u0418\u043d\u0441\u0442\u0430\u0433\u0440\u0430\u043c\u043e\u0432, \u0437\u0430\u0442\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u0433\u0434\u0435-\u0442\u043e \u043d\u0430 \u043a\u043d\u0438\u0436\u043d\u043e\u0439 \u043f\u043e\u043b\u043a\u0435. \u041f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<p>  \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h4>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Xcode \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/189\/7f8\/a11\/1897f8a1179aee4748e3d3887b6e95f6.png\"\/><\/p>\n<p>  \u0411\u0435\u0440\u0435\u043c Single View Application \u0437\u0430 \u043e\u0441\u043d\u043e\u0432\u0443.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/009\/9bc\/293\/0099bc293e6d875c16239b37288a6938.png\"\/><\/p>\n<p>  \u0412\u0432\u043e\u0434\u0438\u043c \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0436\u043c\u0435\u043c \u00abNext\u00bb. \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0435\u0442\u0435\u043d\u0446\u0438\u043e\u0437\u043d\u044b\u0435 \u0440\u0435\u0433\u0430\u043b\u0438\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/33d\/27a\/231\/33d27a23123a12346fcf504b2cc5fe8d.png\"\/><\/p>\n<p>  \u0418 \u043f\u0440\u043e\u0435\u043a\u0442 \u0433\u043e\u0442\u043e\u0432.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/612\/48d\/949\/61248d94982893db73b1f320565c294e.png\"\/><\/p>\n<p>  \u041d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435? \u041a\u0430\u043a\u0430\u044f \u0443\u0436\u0430\u0441\u043d\u0430\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u043f\u043e \u0433\u0440\u0443\u043f\u043f\u0430\u043c! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u044d\u0442\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/93e\/fa9\/bd5\/93efa9bd53ae5e638ce6ebd504e06802.png\"\/><\/p>\n<p>  \u0422\u0430\u043a-\u0442\u043e \u043b\u0443\u0447\u0448\u0435! \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432, \u043d\u043e \u0432 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0432\u044b\u0448\u0435. \u041a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u043a\u043b\u0430\u0432\u0438\u0448 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u2014 \u044d\u0442\u043e Command + Alt + N.<\/p>\n<h4>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 UI<\/h4>\n<p>  \u0422\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c, \u044f \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u0441\u0435\u0431\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 NKLoginViewController \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u0435\u0433\u043e \u043a UIViewController \u043e\u0431\u044a\u0435\u043a\u0442\u0443 \u0432 Interface Builder. \u042d\u0442\u043e\u0442 View Controller \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0432\u044b\u043c, \u0447\u0442\u043e \u0443\u0432\u0438\u0434\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c. \u042d\u0442\u043e \u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u043e \u2014 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0447\u0430\u0442\u0430 \u0431\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438!<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/758\/b50\/efe\/758b50efe71b047fa72ce11a3477df7a.png\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044f \u0440\u0430\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c\u0441\u044f, \u044f \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u043b \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0435 \u043f\u043e\u043b\u044f, \u043a\u0430\u043a Outlet, \u0438 Action \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u0412\u043e\u0439\u0442\u0438\u00bb \u043a \u043d\u0430\u0448\u0435\u043c\u0443 NKLoginViewController. \u0421\u0447\u0438\u0442\u0430\u044e \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u043c \u0442\u043e\u043d\u043e\u043c, \u043f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0442\u044c IB \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 .m \u0444\u0430\u0439\u043b\u0430\u0445, \u0434\u0430\u0431\u044b \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0438\u0437\u0432\u043d\u0435. \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u0434 \u043f\u043e\u0434\u0435\u043b\u0435\u043d \u043d\u0430 \u00ab\u041f\u0440\u0430\u0433\u043c\u044b\u00bb.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d8b\/eb3\/0dc\/d8beb30dc5c49d3dc239b37929224eeb.png\"\/><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 (\u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 IB, \u0442\u0430\u043a \u0438 \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441) \u2014 \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0430\u0442\u043e\u0432. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u043e\u0434 UITableViewController \u2014 \u043d\u0430\u043c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0441\u0432\u0435\u0440\u0445\u044a\u0435\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u0442\u0443\u0442 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u043a\u0430 \u0447\u0442\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/fff\/003\/47a\/fff00347aaf45f9ed9583bd16e6cfe78.png\"\/><\/p>\n<p>  \u0421\u043b\u0435\u0433\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 NKChatListTableViewController.m, \u0447\u0442\u043e\u0431\u044b \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0445\u043e\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u043e\u0441\u044c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0416\u043c\u0438 \u043c\u0435\u043d\u044f!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {     return 20; }  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;cell&quot; forIndexPath:indexPath];     cell.textLabel.text = @&quot;Vasiliy Pupkin&quot;;     return cell; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u043c \u043d\u0430\u0434 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439. \u0412\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0432 \u043e\u0434\u0438\u043d UINavigationController \u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u00ab\u043f\u0443\u0448\u0438\u0442\u044c\u00bb \u0438 \u00ab\u043f\u043e\u043f\u0430\u0442\u044c\u00bb \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u0412\u0441\u0442\u0440\u043e\u0438\u043c \u0436\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 UINavigationController! Let the magic time begin!<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/4ff\/68a\/b8e\/4ff68ab8e34749689f717da3f6f28e8b.png\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 Segue \u043e\u0442 Login View Controller \u0434\u043e Chat List Table View Controller. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0435 \u00abSegueToChatList\u00bb. \u0412\u043e\u0442 \u0442\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0435\u0439\u0447\u0430\u0441.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/1e2\/119\/7d7\/1e21197d7e245d4aafbfca842e5b8301.png\"\/><\/p>\n<p>  \u0421\u043b\u0435\u0433\u043a\u0430 \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u043d\u0430\u0434 \u043a\u043e\u0434\u043e\u043c Login View Controller. \u0414\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u0435\u043b\u0435\u0433\u0430\u0442\u043e\u043c \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0445 \u043f\u043e\u043b\u0435\u0439.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f4c\/621\/e3e\/f4c621e3e2d3f08193c0ff620903bcb3.gif\"\/><\/p>\n<p>  \u0410 \u0441\u0430\u043c \u043a\u043e\u0434 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NKLoginViewController.h<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &lt;UIKit\/UIKit.h&gt;  \/\/ \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 @interface NKLoginViewController : UIViewController &lt;UITextFieldDelegate&gt;  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NKLoginViewController.m<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;NKLoginViewController.h&quot;  @interface NKLoginViewController ()  @property (weak, nonatomic) IBOutlet UITextField *emailTextField; @property (weak, nonatomic) IBOutlet UITextField *passwordTextField;  - (IBAction)loginTouched:(UIButton *)sender;  @end  @implementation NKLoginViewController  #pragma mark - UITextFieldDelegate -  \/\/ \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e &quot;Done&quot; \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0430 \u043f\u0440\u044f\u0442\u0430\u043b\u0430\u0441\u044c - (BOOL)textFieldShouldReturn:(UITextField *)textField {     [textField resignFirstResponder];     return YES; }  #pragma mark - Button methods -  \/\/ \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043c\u0441\u044f \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u043a\u0440\u0430\u043d \u043f\u043e \u043d\u0430\u0436\u0430\u0442\u0438\u044e \u043a\u043d\u043e\u043f\u043a\u0438 &quot;\u0412\u043e\u0439\u0442\u0438&quot;. - (IBAction)loginTouched:(UIButton *)sender {     [self performSegueWithIdentifier:@&quot;SegueToChatList&quot; sender:self]; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430 \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u043b\u043e\u0433\u0438\u043d\u0430 \u0432\u0432\u0435\u0440\u0445 \u2014 \u044d\u0442\u043e \u0432\u0435\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 UI. \u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0432\u0432\u0435\u0440\u0445 \u043f\u0440\u0438 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>  \u041d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u044b\u043a\u0430\u0442\u044c!<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/652\/ac4\/926\/652ac4926c15d08286ff39f3dc41de07.gif\"\/><\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0440\u0435\u0442\u0438\u0439 \u2014 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u2014 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u041f\u043e\u043f\u0430\u0434\u0430\u0442\u044c \u0432 \u043d\u0435\u0433\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u044f\u0447\u0435\u0439\u043a\u0443 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0421\u0430\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 UITableView, \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f \u0438 \u043a\u043d\u043e\u043f\u043a\u0438 \u00ab\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u00bb. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u044d\u0442\u043e\u0442 \u044d\u043a\u0440\u0430\u043d \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/ef1\/6ad\/9eb\/ef16ad9eb6fb8e752f7c96baa37792a8.png\"\/><\/p>\n<p>  \u041a\u043e\u0434 NKChatViewController.m \u043d\u0438\u0436\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0416\u043c\u0438 \u043c\u0435\u043d\u044f!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;NKChatViewController.h&quot;  @interface NKChatViewController ()  @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UITextField *messageTextField;  - (IBAction)sendTouched:(UIButton *)sender;  @end  @implementation NKChatViewController  #pragma mark - View Controller life cycle -  - (void)viewDidAppear:(BOOL)animated {     [super viewDidAppear:animated];          \/\/ \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u043c \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440     [_messageTextField becomeFirstResponder]; }  #pragma mark - UITableViewDataSource -  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {     return 20; }  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;cell&quot;];     cell.textLabel.text = @&quot;\u0412\u0430\u0441\u044f \u041f\u0443\u043f\u043a\u0435\u043d&quot;;     cell.detailTextLabel.text = @&quot;\u041f\u0440\u0438\u0432\u0435\u0442, \u043a\u0430\u043a \u0434\u0435\u043b\u0430?&quot;;     return cell; }  #pragma mark - Button methods -  - (IBAction)sendTouched:(UIButton *)sender {      }  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 UI \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0435\u0441\u0441\u0435\u043d\u0434\u0436\u0435\u0440\u0430 \u0433\u043e\u0442\u043e\u0432. \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2014 \u043d\u0430\u0447\u0438\u043d\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f!<\/p>\n<h4>\u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/h4>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c C2Call. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0432\u0430\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c, \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 24\u0445 \u0447\u0430\u0441\u043e\u0432.<\/p>\n<p>  \u0412\u0441\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 c2call.com \u0438 \u043a\u0443\u043f\u0438\u0442\u044c \u0443\u0447\u0435\u0442\u043a\u0443 \u0437\u0430 $100. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0432 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 low-language API. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0447\u0442\u043e-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0432\u0430\u043c\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u043e\u043c\u0435\u0441\u044f\u0447\u043d\u043e\u0439 \u043e\u043f\u043b\u0430\u0442\u044b C2Call \u0441\u043d\u044f\u043b\u0438 \u0441 \u043c\u0435\u043d\u044f $100 \u0438, \u043f\u043e\u0445\u043e\u0436\u0435, \u0437\u0430\u0431\u044b\u043b\u0438 \u043f\u0440\u043e \u043c\u0435\u043d\u044f. \u0411\u043e\u043b\u044c\u0448\u0435 \u0434\u0435\u043d\u0435\u0433 \u043d\u0435 \u0441\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438. \u042f \u043d\u0435 \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e \u0432\u0430\u0441 \u043d\u0438 \u043f\u043e\u043a\u0443\u043f\u0430\u0442\u044c \u043f\u0440\u043e\u0434\u0443\u043a\u0442, \u043d\u0438 \u043f\u044b\u0442\u0430\u0442\u044c \u0443\u0434\u0430\u0447\u0443 \u0441 \u043c\u0435\u0441\u044f\u0447\u043d\u043e\u0439 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u043e\u0439. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u043c\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0435\u0437\u043b\u043e.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u043a\u0443\u043f\u043a\u0438 \u0443\u0447\u0435\u0442\u043a\u0438 \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u2014 \u044d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043a\u0430\u0447\u0430\u0435\u043c SDK. \u0412 \u0430\u0440\u0445\u0438\u0432\u0435 \u043f\u0430\u0440\u0430-\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432, \u043a\u0430\u043a \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0434\u0432\u0430 \u043e\u0431\u044a\u0435\u043a\u0442\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/e1f\/d83\/131\/e1fd83131825f1b219da2fcab51113d9.png\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u0438\u0445 \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f64\/8d3\/808\/f648d380862b800c85f2786a044cff20.png\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0423\u0436\u0430\u0441\u0430\u044e\u0449\u0438\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a<\/b><\/p>\n<div class=\"spoiler_text\">AVFoundation.framework <br \/>  Accounts.framework <br \/>  AdSupport.framework <br \/>  AddressBook.framework <br \/>  AddressBookUI.framework <br \/>  AssetsLibrary.framework <br \/>  AudioToolbox.framework <br \/>  CFNetwork.framework <br \/>  CoreAudio.framework <br \/>  CoreData.framework <br \/>  CoreFoundation.framework <br \/>  CoreLocation.framework <br \/>  CoreMedia.framework <br \/>  CoreTelephony.framework <br \/>  CoreText.framework <br \/>  CoreVideo.framework <br \/>  MapKit.framework <br \/>  MediaPlayer.framework <br \/>  MessageUI.framework <br \/>  MobileCoreServices.framework <br \/>  OpenGLES.framework <br \/>  QuartzCore.framework <br \/>  QuickLook.framework <br \/>  Security.framework <br \/>  StoreKit.framework <br \/>  SystemConfiguration.framework <br \/>  iAd.framework <br \/>  libsqlite3.dylib <br \/>  libz.dylib   <\/div>\n<\/div>\n<p>  \u0418 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0432 Build Settings:<\/p>\n<p>  HEADER_SEARCH_PATHS = \/usr\/include\/libxml2 <br \/>  OTHER_LDFLAGS = -lxml2 -lstdc++ <br \/>  ARCHS = armv7 <br \/>  VALID_ARCHS = armv7<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u043c App Delegate:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NKAppDelegate.h<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &lt;UIKit\/UIKit.h&gt; #import &lt;SocialCommunication\/SocialCommunication.h&gt;  @interface NKAppDelegate : C2CallAppDelegate &lt;UIApplicationDelegate&gt;  @property (strong, nonatomic) UIWindow *window;  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NKAppDelegate.m<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">@implementation NKAppDelegate  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {     self.affiliateid = @&quot;6B9DF5671444320162B&quot;;     self.secret = @&quot;2fd9cd18aa4d957a4030c0455101646d&quot;;          return [super application:application didFinishLaunchingWithOptions:launchOptions]; }  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041c\u044b \u0437\u0430\u0441\u0430\u0431\u043a\u043b\u0430\u0441\u0441\u0438\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043e\u0442 C2Call, \u0434\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b\u0438 \u0435\u043c\u0443 \u043e \u043d\u0430\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u0430\u0448\u0438 Affiliate ID \u0438 Secret \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430.<\/p>\n<p>  \u0417\u0430\u043a\u043e\u043d\u0447\u0438\u043b\u0438 \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u043f\u043e\u0440\u0430 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u0434\u043a\u043b\u0430\u0441\u0441 NSObject \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c NKChat, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u044b \u0438\u043d\u043a\u0430\u043f\u0441\u0443\u043b\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0447\u0430\u0442\u0430. \u0414\u0443\u043c\u0430\u044e, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0434\u0430\u0442\u044c \u0432\u0430\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u044b\u0439 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043a\u043e\u0434\u0430 NKChat.m, \u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0435\u0433\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NKChat.m<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;NKChat.h&quot; #import &lt;SocialCommunication\/SocialCommunication.h&gt;  @implementation NKChat  #pragma mark - Singleton pattern -  \/\/ 1 + (instancetype)sharedManager {     static NKChat *sharedChat = nil;     static dispatch_once_t onceToken;     dispatch_once(&onceToken, ^{         sharedChat = [self new];     });     return sharedChat; }  #pragma mark - Accessors -  \/\/ 2 - (NSArray *)chatHistory {     return [self fetchChatHistory]; }  #pragma mark - General methods -  \/\/ 3 - (void)login:(NSString *)email password:(NSString *)password success:(void(^)())successBlock failure:(void(^)())failureBlock {     NSDictionary *dictionary = @{@&quot;EMail&quot;:email,                                  @&quot;Password&quot;:password};          [[C2CallPhone currentPhone] registerUser:dictionary                        withCompletionHandler:^(BOOL success, NSString *result) {                           if (success) {                                [[C2CallPhone currentPhone] startC2CallPhone];                                successBlock();                            } else {                                failureBlock();                            }                        }]; }  \/\/ 4 - (void)logout {     [(C2CallAppDelegate *)[UIApplication sharedApplication].delegate logoutUser]; }  \/\/ 5 - (void)sendMessage:(NSString *)message toUser:(NSString *)userId {     [[C2CallPhone currentPhone] submitMessage:message toUser:userId]; }  \/\/ 6 - (NSArray *)fetchChatHistory {     \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 Managed Object \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0447\u0430\u0442\u0430     NSFetchRequest *request = [[SCDataManager instance] fetchRequestForChatHistory:YES];     NSFetchedResultsController *controller = [[SCDataManager instance] fetchedResultsControllerWithFetchRequest:request sectionNameKeyPath:nil cacheName:nil];     NSError *error;     [controller performFetch:&error];          \/\/ \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432     NSMutableArray *result = [NSMutableArray array];     for (NSManagedObject *chat in controller.fetchedObjects) {         \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0447\u0430\u0442\u0430         NSArray *chatKeys = @[@&quot;contact&quot;, @&quot;lastTimestamp&quot;, @&quot;missedEvents&quot;];         NSMutableDictionary *inChat = [[chat dictionaryWithValuesForKeys:chatKeys] mutableCopy];                  \/\/ \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b         NSMutableDictionary *dublicate = nil;         for (NSMutableDictionary *dict in result) {             if ([dict[@&quot;contact&quot;] isEqualToString:inChat[@&quot;contact&quot;]]) {                 dublicate = dict;                 break;             }         }                  \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0441\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f         NSMutableArray *messages = (dublicate) ? dublicate[@&quot;messages&quot;] : [NSMutableArray array];         for (NSManagedObject *chatEvent in [chat valueForKey:@&quot;chatHistory&quot;]) {             NSArray *chatEventKeys = [[[chatEvent entity] attributesByName] allKeys];             NSMutableDictionary *inChatEvent = [[chatEvent dictionaryWithValuesForKeys:chatEventKeys] mutableCopy];             \/\/            NSLog(@&quot;%@&quot;,inChatEvent);             inChatEvent[@&quot;ManagedObject&quot;] = chatEvent;             [messages addObject:inChatEvent];         }         [messages sortUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@&quot;timevalue&quot; ascending:YES]]];                  if (dublicate) {             dublicate[@&quot;messages&quot;] = messages;             [dublicate[@&quot;ManagedObjects&quot;] addObject:chat];             dublicate[@&quot;missedEvents&quot;] = @([dublicate[@&quot;missedEvents&quot;] intValue] + [inChat[@&quot;missedEvents&quot;] intValue]);             if (!dublicate[@&quot;name&quot;])                 dublicate[@&quot;name&quot;] = inChat[@&quot;name&quot;];         } else {             inChat[@&quot;messages&quot;] = messages;             inChat[@&quot;ManagedObjects&quot;] = [NSMutableArray arrayWithObject:chat];         }                  \/\/ \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442         if (!dublicate)             [result addObject:inChat];     }          \/\/ \u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442     [result sortUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@&quot;lastTimestamp&quot; ascending:NO]]];          \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u043c\u0430\u0441\u0441\u0438\u0432     return [result copy]; }  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e\u0439\u0434\u0435\u043c \u043f\u043e-\u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<ol>\n<li>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u2014 \u0441\u0438\u043d\u0433\u043b\u0442\u043e\u043d. \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u043b\u044f \u0432\u0430\u0441 \u0437\u0434\u0435\u0441\u044c \u0431\u044b\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e. \u0423 \u043d\u0430\u0441 \u043e\u0434\u0438\u043d \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0447\u0430\u0442 \u2014 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0430\u0434\u043e.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434-\u0430\u043a\u0441\u0435\u0441\u0441\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0447\u0430\u0442\u0430 \u0432 \u043d\u0443\u0436\u043d\u043e\u0439 \u043d\u0430\u043c \u0444\u043e\u0440\u043c\u0435.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u043b\u043e\u0433\u0438\u043d\u0430. \u0424\u0438\u0448\u043a\u0430 C2Call \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0445\u043e\u0434\u0438\u0442\u0435 \u0441 \u043e\u0434\u043d\u0438\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u0432\u044b \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0435\u0441\u044c. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0445\u043e\u0434\u0438\u0442\u0435 \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437, \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0445\u043e\u0434\u0438\u0442\u0435. \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043a\u0430\u043a-\u0440\u0430\u0437 \u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u043c \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u0430\u043c, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0442 C2Call, \u0434\u0430\u0431\u044b \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043b\u043e\u0433\u0430\u0443\u0442\u0430. \u0414\u0435\u0448\u0435\u0432\u043e \u0438 \u0441\u0435\u0440\u0434\u0438\u0442\u043e.<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u043f\u043e\u0441\u044b\u043b\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u2014 \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442.<\/li>\n<li>\u0423\u0436\u0430\u0441\u043d\u044b\u0439 \u0438 \u043c\u043e\u043d\u0441\u0442\u0440\u0443\u043e\u0437\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434-\u0441\u043a\u0430\u0442\u0435\u0440\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0447\u0430\u0442\u0430. \u0417\u0434\u0435\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u043d\u044b \u0432\u0441\u0435 \u043a\u0430\u043c\u043d\u0438, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f C2Call. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0434\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 Core Data. \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0438\u043c\u0435\u043d\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u043e\u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u2014 \u0442\u043e id \u043f\u0440\u0438\u0434\u0435\u0442, \u0442\u043e \u0438\u043c\u044f \u0438 \u0444\u0430\u043c\u0438\u043b\u0438\u044f. \u0412-\u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u0440\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u0441\u043e\u0439\u0434\u0435\u0442 \ud83d\ude42<\/li>\n<\/ol>\n<p>  \u041d\u0443, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b, \u043f\u043e\u0440\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0433\u0438\u044e \u043a\u043e\u0434\u0430!<\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0432 NKAppDelegate.m \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e NKChat, \u0435\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e\u0433\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">NKAppDelegate.m<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;NKAppDelegate.h&quot;  @implementation NKAppDelegate  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {     self.affiliateid = @&quot;6B9DF5671444320162B&quot;;     self.secret = @&quot;2fd9cd18aa4d957a4030c0455101646d&quot;;     [NKChat sharedManager];     return [super application:application didFinishLaunchingWithOptions:launchOptions]; }  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043b\u0435\u0433\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043c\u0435\u0442\u043e\u0434 loginTouched \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 NKLoginViewController. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043c\u043f\u043e\u0440\u0442 NKChat!<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0416\u043c\u0438 \u043c\u0435\u043d\u044f!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">- (IBAction)loginTouched:(UIButton *)sender {     sender.enabled = NO;     [[NKChat sharedManager] login:_emailTextField.text                          password:_passwordTextField.text                           success:^{                               [self performSegueWithIdentifier:@&quot;SegueToChatList&quot; sender:self];                               sender.enabled = YES;                           }                           failure:^{                               sender.enabled = YES;                           }]; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u043a\u043d\u043e\u043f\u043a\u0443, \u043f\u043e\u043a\u0430 \u0433\u0440\u0443\u0437\u0438\u0442\u0441\u044f \u043e\u0442\u0432\u0435\u0442 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0441\u043f\u0435\u0445\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443, \u0432\u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0434\u0432\u0443\u043c\u044f \u0443\u0447\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438: nikita@borodutch.com \u0438 luke@borodutch.com. \u041c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0434\u0438\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u044d\u0442\u0438\u043c \u0434\u0432\u0443\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c, \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<p>  \u0421\u043b\u0435\u0433\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u043c NKChatListTableViewController.m \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438\u043c \u0434\u0432\u0443\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0416\u043c\u0438 \u043c\u0435\u043d\u044f!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;NKChatListTableViewController.h&quot;  @interface NKChatListTableViewController ()  @end  @implementation NKChatListTableViewController  #pragma mark - UITableViewDataSource -  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {     return 2; }  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;cell&quot; forIndexPath:indexPath];     cell.textLabel.text = (indexPath.row) ? @&quot;nikita@borodutch.com&quot; : @&quot;luke@borodutch.com&quot;;     return cell; }  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7af\/2d5\/14c\/7af2d514c11e1633da7ce7c8df3ac9e7.png\"\/><\/p>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u0442\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0432 NKChatListTableViewController.m.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0416\u043c\u0438 \u043c\u0435\u043d\u044f!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UITableViewCell *)sender {     UIViewController *dest = segue.destinationViewController;     dest.title = sender.textLabel.text; } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u0443\u044e \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0447\u0430\u0442\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c! \u0414\u0435\u043b\u043e \u0432 \u0448\u043b\u044f\u043f\u0435, \u0441\u0443\u0434\u0430\u0440\u044c.<\/p>\n<p>  \u041a\u0430\u043a \u0432 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043b\u0438\u0441\u0442\u0438\u043d\u0433 NKChatViewController.m \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0416\u043c\u0438 \u043c\u0435\u043d\u044f!<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"objectivec\">#import &quot;NKChatViewController.h&quot; #import &lt;SocialCommunication\/SocialCommunication.h&gt; #import &quot;NKChat.h&quot;  @interface NKChatViewController ()  @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UITextField *messageTextField;  - (IBAction)sendTouched:(UIButton *)sender;  @end  @implementation NKChatViewController {     NSArray *tableData; }  #pragma mark - View Controller life cycle -  - (void)viewDidLoad {     [super viewDidLoad];          \/\/ 1     tableData = [self getTableData]; }  - (void)viewDidAppear:(BOOL)animated {     [super viewDidAppear:animated];          \/\/ \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443, \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u043c \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440     [_messageTextField becomeFirstResponder];          \/\/ 2     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedMessage) name:@&quot;kC2CallPhoneReceivedMessage&quot; object:nil]; }  #pragma mark - UITableViewDataSource -  - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {     \/\/ 3     return tableData.count; }  - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {     \/\/ 4     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@&quot;cell&quot;];     cell.textLabel.text = ([tableData[indexPath.row][@&quot;eventType&quot;] isEqualToString:@&quot;MessageIn&quot;]) ? self.title : @&quot;\u042f&quot;;     cell.detailTextLabel.text = tableData[indexPath.row][@&quot;text&quot;];     return cell; }  #pragma mark - Button methods -  - (IBAction)sendTouched:(UIButton *)sender {     \/\/ 5     [[NKChat sharedManager] sendMessage:_messageTextField.text                                  toUser:@&quot;c45645f71465dcff18e&quot;];     [self addMessage:_messageTextField.text];     _messageTextField.text = @&quot;&quot;; }  #pragma mark - General Methods -  - (void)addMessage:(NSString *)message {     \/\/ 6     NSMutableArray *mTableData = [tableData mutableCopy];     [mTableData addObject:@{@&quot;text&quot;:message,                             @&quot;eventType&quot;:@&quot;MessageOut&quot;}];     tableData = mTableData;     [_tableView reloadData]; }  - (void)receivedMessage {     \/\/ 7     tableData = [self getTableData];     [_tableView reloadData]; }  - (NSArray *)getTableData {     \/\/ 8     for (NSDictionary *chat in [NKChat sharedManager].chatHistory)         if ([chat[@&quot;contact&quot;] isEqualToString:self.title])             return chat[@&quot;messages&quot;];     return nil; }  @end <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  \u041f\u043e-\u043f\u043e\u0440\u044f\u0434\u043a\u0443:<\/p>\n<ol>\n<li>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u043b\u0441\u044f, \u043c\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/li>\n<li>kC2CallPhoneReceivedMessage \u2014 \u044d\u0442\u043e \u0434\u0435\u0444\u0438\u043d\u0438\u0446\u0438\u044f \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0438\u0448\u043b\u043e \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435; \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u044d\u0442\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u0435<\/li>\n<li>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u044f\u0447\u0435\u0435\u043a, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0441\u0435\u0433\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0435\u0441\u0442\u044c \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0447\u0430\u0442\u0430<\/li>\n<li>\u041a\u0430\u0436\u0434\u043e\u0439 \u044f\u0447\u0435\u0439\u043a\u0435 \u0434\u0430\u0435\u043c \u043d\u0443\u0436\u043d\u043e\u0435 \u0438\u043c\u044f \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430 \u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/li>\n<li>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u0437 NKChat; \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044e \u043d\u0443\u0436\u043d\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u044e C2Call; \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438<\/li>\n<li>\u041c\u0435\u0442\u043e\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u041f\u043e\u043b\u0430\u0433\u0430\u044e, \u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d<\/li>\n<li>\u041f\u0440\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435 \u0438 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0434\u0430\u043d\u043d\u044b\u0435<\/li>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043f\u043e \u0432\u0441\u0435\u0439 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043d\u0430\u043c \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430<\/li>\n<\/ol>\n<p>  \u0412\u043e\u0442, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c (\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0433\u0438\u0444\u043a\u0430):<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/f65\/248\/fa6\/f65248fa6a92e8e4092f6cfe730afab7.gif\"\/><\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430. \u0412 \u0441\u043a\u043e\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u0430\u043a \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043f\u0430\u0440\u0430 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u044b\u0445 \u0434\u0435\u043d\u044c\u043a\u043e\u0432, \u043d\u0430\u043f\u0438\u0448\u0443 \u0432\u0442\u043e\u0440\u0443\u044e \u0447\u0430\u0441\u0442\u044c. \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 <a href=\"https:\/\/github.com\/backmeupplz\/C2Call-Tutorial-Part-1\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043c\u044b \u0440\u0435\u0448\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0449\u0435\u043f\u0435\u0442\u0438\u043b\u044c\u043d\u044b\u0445 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043f\u043e UI, \u043e\u0431\u043e\u0439\u0434\u0435\u043c \u043f\u0430\u0440\u0443 \u0431\u0430\u0433\u043e\u0432 C2Call (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u043e\u0442, \u0447\u0442\u043e \u0432\u0438\u0434\u0435\u043d \u043d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0433\u0438\u0444\u043a\u0435 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439), \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0438 \u0432\u043b\u0435\u043f\u0438\u043c \u043f\u0430\u0440\u0443-\u0442\u0440\u043e\u0439\u043a\u0443 \u043a\u043e\u0442\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u0438\u0435-\u043b\u0438\u0431\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0443, \u0441\u043c\u0435\u043b\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0438\u0445 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u2014 \u043d\u0430 \u0432\u0441\u0435 \u043e\u0442\u0432\u0435\u0447\u0443.<\/p>\n<p>  \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0432\u0430\u043c\u0438 \u043e\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u0438\u043b\u0438 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0435\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u043f\u0440\u043e\u0448\u0443 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u043c\u043e\u0439 \u0445\u0430\u0431\u0440\u0430\u0446\u0435\u043d\u0442\u0440.<\/p>\n<p>  \u0414\u043e \u0441\u043a\u043e\u0440\u043e\u0439 \u0432\u0441\u0442\u0440\u0435\u0447\u0438. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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\/225079\/\"> http:\/\/habrahabr.ru\/post\/225079\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/d59\/e3c\/cb8\/d59e3ccb8b7fac27d79ae2d9e644848e.jpg\"\/><\/p>\n<p>  \u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435, \u0434\u043e\u0440\u043e\u0433\u0438\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440\u0430!<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0435\u0440\u0438\u0438 \u0441\u0442\u0430\u0442\u0435\u0439 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0431\u044b\u0441\u0442\u0440\u043e \u0438 \u043f\u043e\u0447\u0442\u0438 \u0431\u0435\u0437\u0431\u043e\u043b\u0435\u0437\u043d\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 WhatsApp \u043f\u043e\u0434 iOS. \u0421\u0442\u0430\u0442\u044c\u044e \u0434\u0435\u043b\u044e \u043d\u0430 \u0434\u0432\u0435 \u0447\u0430\u0441\u0442\u0438 \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430:<\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 UI, \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439<\/li>\n<li>\u0414\u0435\u043b\u0430\u0435\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 UI, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432\u0438\u0434\u0435\u043e \u0438 \u0430\u0443\u0434\u0438\u043e \u0437\u0432\u043e\u043d\u043a\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0444\u043e\u0442\u043e \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432<\/li>\n<\/ol>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043f\u043e\u0441\u043e\u0431\u0438\u0435 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430\u0431\u0440\u0430\u0442\u044c 400 000 000 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u043f\u0440\u043e\u0434\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0438\u0441 \u0437\u0430 19 \u0418\u043d\u0441\u0442\u0430\u0433\u0440\u0430\u043c\u043e\u0432, \u0437\u0430\u0442\u0435\u0440\u044f\u043b\u043e\u0441\u044c \u0433\u0434\u0435-\u0442\u043e \u043d\u0430 \u043a\u043d\u0438\u0436\u043d\u043e\u0439 \u043f\u043e\u043b\u043a\u0435. \u041f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0435\u0433\u043e \u043d\u0430\u0439\u0442\u0438, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<p>  \u0417\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u0440\u043e\u0448\u0443 \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/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-225079","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225079","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=225079"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/225079\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=225079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=225079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=225079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}