From 350e161519816b851a7d9d1ce4f4c03b7510450a Mon Sep 17 00:00:00 2001 From: Dmytro Omelchuk Date: Tue, 7 Apr 2015 14:56:01 +0300 Subject: [PATCH] Made path to stored image creating dynamically since app id is changing every time app is launched --- .../project.pbxproj | 52 ++++++++++++++++--- CSNCensorNetUaProject/AppDelegate.h | 4 +- .../CSNNewsTableViewController.h | 1 - .../CSNNewsTableViewController.m | 1 - .../NewsData.xcdatamodel/contents | 3 +- .../Sources/CSNArticlesTableViewController.h | 1 - .../Sources/CSNArticlesTableViewController.m | 2 +- .../Sources/CSNCommonFunctions.h | 15 ++++++ .../Sources/CSNCommonFunctions.m | 19 +++++++ CSNCensorNetUaProject/Sources/CSNDownloader.h | 6 +-- CSNCensorNetUaProject/Sources/CSNDownloader.m | 20 +++---- CSNCensorNetUaProject/Sources/CSNNews.h | 3 +- CSNCensorNetUaProject/Sources/CSNNews.m | 12 ++--- .../Sources/CSNNewsDetailsViewController.h | 1 - .../Sources/CSNPrefixHeader.pch | 22 ++++++++ .../Sources/CSNXMLParserOperation.h | 2 - .../Sources/CSNXMLParserOperation.m | 7 ++- CSNCensorNetUaProject/main.m | 1 - 18 files changed, 118 insertions(+), 54 deletions(-) create mode 100644 CSNCensorNetUaProject/Sources/CSNCommonFunctions.h create mode 100644 CSNCensorNetUaProject/Sources/CSNCommonFunctions.m create mode 100644 CSNCensorNetUaProject/Sources/CSNPrefixHeader.pch diff --git a/CSNCensorNetUaProject.xcodeproj/project.pbxproj b/CSNCensorNetUaProject.xcodeproj/project.pbxproj index 09b5e52..aa84606 100644 --- a/CSNCensorNetUaProject.xcodeproj/project.pbxproj +++ b/CSNCensorNetUaProject.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1A0BB12A1AD3F828004D3E1C /* CSNCommonFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A0BB1291AD3F828004D3E1C /* CSNCommonFunctions.m */; }; 1A3EC1601ACC9AFD001D43D3 /* NewsData.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 1A3EC15E1ACC9AFD001D43D3 /* NewsData.xcdatamodeld */; }; 1A4494F01AB87A7100DB3E4E /* CSNNewsTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A4494EF1AB87A7100DB3E4E /* CSNNewsTableViewController.m */; }; 1A689C581ABC7D92004A6627 /* CSNDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A689C571ABC7D92004A6627 /* CSNDownloader.m */; }; @@ -34,6 +35,9 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 1A0BB1271AD3F53A004D3E1C /* CSNPrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSNPrefixHeader.pch; path = Sources/CSNPrefixHeader.pch; sourceTree = ""; }; + 1A0BB1281AD3F7FC004D3E1C /* CSNCommonFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = CSNCommonFunctions.h; path = Sources/CSNCommonFunctions.h; sourceTree = ""; }; + 1A0BB1291AD3F828004D3E1C /* CSNCommonFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CSNCommonFunctions.m; path = Sources/CSNCommonFunctions.m; sourceTree = ""; }; 1A3EC15F1ACC9AFD001D43D3 /* NewsData.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = NewsData.xcdatamodel; sourceTree = ""; }; 1A4494EE1AB87A7100DB3E4E /* CSNNewsTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSNNewsTableViewController.h; sourceTree = ""; }; 1A4494EF1AB87A7100DB3E4E /* CSNNewsTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSNNewsTableViewController.m; sourceTree = ""; }; @@ -80,6 +84,38 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 1A0BB12B1AD3FB09004D3E1C /* Resources */ = { + isa = PBXGroup; + children = ( + 1AF3C5981AB877F4006FB959 /* Main.storyboard */, + 1AF3C59B1AB877F4006FB959 /* Images.xcassets */, + 1AF3C59D1AB877F4006FB959 /* LaunchScreen.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 1A0BB12C1AD3FB25004D3E1C /* Common */ = { + isa = PBXGroup; + children = ( + 1AF3C58F1AB877F4006FB959 /* AppDelegate.h */, + 1AF3C5901AB877F4006FB959 /* AppDelegate.m */, + 1A0BB1271AD3F53A004D3E1C /* CSNPrefixHeader.pch */, + 1A0BB1281AD3F7FC004D3E1C /* CSNCommonFunctions.h */, + 1A0BB1291AD3F828004D3E1C /* CSNCommonFunctions.m */, + ); + name = Common; + sourceTree = ""; + }; + 1A0BB12D1AD3FB48004D3E1C /* Model */ = { + isa = PBXGroup; + children = ( + 1AA5EBB21ABAF9B90066A62B /* CSNNews.h */, + 1AA5EBB31ABAF9B90066A62B /* CSNNews.m */, + 1A3EC15E1ACC9AFD001D43D3 /* NewsData.xcdatamodeld */, + ); + name = Model; + sourceTree = ""; + }; 1AF3C57F1AB877F4006FB959 = { isa = PBXGroup; children = ( @@ -101,8 +137,7 @@ 1AF3C58A1AB877F4006FB959 /* CSNCensorNetUaProject */ = { isa = PBXGroup; children = ( - 1AF3C58F1AB877F4006FB959 /* AppDelegate.h */, - 1AF3C5901AB877F4006FB959 /* AppDelegate.m */, + 1A0BB12C1AD3FB25004D3E1C /* Common */, 1A4494EE1AB87A7100DB3E4E /* CSNNewsTableViewController.h */, 1A4494EF1AB87A7100DB3E4E /* CSNNewsTableViewController.m */, 1ACFF8041AC02B2C00B0DE11 /* CSNNewsDetailsViewController.h */, @@ -111,16 +146,12 @@ 1A742AE71ABDA0BE00849948 /* CSNNewsTableViewCell.m */, 1A6DF5051AC43E6C00C92AFF /* CSNArticlesTableViewController.h */, 1A6DF5061AC43E6C00C92AFF /* CSNArticlesTableViewController.m */, - 1AA5EBB21ABAF9B90066A62B /* CSNNews.h */, - 1AA5EBB31ABAF9B90066A62B /* CSNNews.m */, 1AA5EBB51ABAFB1F0066A62B /* CSNXMLParserOperation.h */, 1AA5EBB61ABAFB1F0066A62B /* CSNXMLParserOperation.m */, 1A689C561ABC7D92004A6627 /* CSNDownloader.h */, 1A689C571ABC7D92004A6627 /* CSNDownloader.m */, - 1AF3C5981AB877F4006FB959 /* Main.storyboard */, - 1AF3C59B1AB877F4006FB959 /* Images.xcassets */, - 1AF3C59D1AB877F4006FB959 /* LaunchScreen.xib */, - 1A3EC15E1ACC9AFD001D43D3 /* NewsData.xcdatamodeld */, + 1A0BB12D1AD3FB48004D3E1C /* Model */, + 1A0BB12B1AD3FB09004D3E1C /* Resources */, 1AF3C58B1AB877F4006FB959 /* Supporting Files */, ); path = CSNCensorNetUaProject; @@ -257,6 +288,7 @@ 1AA5EBB71ABAFB1F0066A62B /* CSNXMLParserOperation.m in Sources */, 1AF3C5911AB877F4006FB959 /* AppDelegate.m in Sources */, 1AA5EBB41ABAF9B90066A62B /* CSNNews.m in Sources */, + 1A0BB12A1AD3F828004D3E1C /* CSNCommonFunctions.m in Sources */, 1A6DF5071AC43E6C00C92AFF /* CSNArticlesTableViewController.m in Sources */, 1A4494F01AB87A7100DB3E4E /* CSNNewsTableViewController.m in Sources */, 1AF3C58E1AB877F4006FB959 /* main.m in Sources */, @@ -385,6 +417,8 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = CSNCensorNetUaProject/Sources/CSNPrefixHeader.pch; INFOPLIST_FILE = CSNCensorNetUaProject/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -395,6 +429,8 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = CSNCensorNetUaProject/Sources/CSNPrefixHeader.pch; INFOPLIST_FILE = CSNCensorNetUaProject/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/CSNCensorNetUaProject/AppDelegate.h b/CSNCensorNetUaProject/AppDelegate.h index b801bd1..9dad7d6 100644 --- a/CSNCensorNetUaProject/AppDelegate.h +++ b/CSNCensorNetUaProject/AppDelegate.h @@ -5,9 +5,9 @@ // Created by Dmytro Omelchuk on 3/17/15. // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // +//////////////////////////////////////////////////////////////////////////////// -#import - +//////////////////////////////////////////////////////////////////////////////// @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; diff --git a/CSNCensorNetUaProject/CSNNewsTableViewController.h b/CSNCensorNetUaProject/CSNNewsTableViewController.h index 5d06383..faed4ca 100644 --- a/CSNCensorNetUaProject/CSNNewsTableViewController.h +++ b/CSNCensorNetUaProject/CSNNewsTableViewController.h @@ -6,7 +6,6 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import //////////////////////////////////////////////////////////////////////////////// @interface CSNNewsTableViewController : UITableViewController diff --git a/CSNCensorNetUaProject/CSNNewsTableViewController.m b/CSNCensorNetUaProject/CSNNewsTableViewController.m index 05163e5..b311c72 100644 --- a/CSNCensorNetUaProject/CSNNewsTableViewController.m +++ b/CSNCensorNetUaProject/CSNNewsTableViewController.m @@ -253,7 +253,6 @@ - (CSNNews *)newsWithDictionary:(NSDictionary *)aDictionary theResultNews.pubDate = aDictionary[kPubDateName]; theResultNews.comments = aDictionary[kCommentsName]; theResultNews.enclosure = aDictionary[kEnclosureName]; - theResultNews.imagePath = aDictionary[kImagePathName]; theResultNews.content = aDictionary[kContentName]; return theResultNews; diff --git a/CSNCensorNetUaProject/Resources/NewsData.xcdatamodeld/NewsData.xcdatamodel/contents b/CSNCensorNetUaProject/Resources/NewsData.xcdatamodeld/NewsData.xcdatamodel/contents index 7142da3..b5e406c 100644 --- a/CSNCensorNetUaProject/Resources/NewsData.xcdatamodeld/NewsData.xcdatamodel/contents +++ b/CSNCensorNetUaProject/Resources/NewsData.xcdatamodeld/NewsData.xcdatamodel/contents @@ -6,12 +6,11 @@ - - + \ No newline at end of file diff --git a/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.h b/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.h index 08bb632..43aca79 100644 --- a/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.h +++ b/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.h @@ -6,7 +6,6 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import //////////////////////////////////////////////////////////////////////////////// @interface CSNArticlesTableViewController : UITableViewController diff --git a/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.m b/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.m index 4cd6cd2..125fb7c 100644 --- a/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.m +++ b/CSNCensorNetUaProject/Sources/CSNArticlesTableViewController.m @@ -79,7 +79,7 @@ - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:( CSNNews *theNews = self.articles[anIndexPath.row]; theCell.dateLabel.text = [NSDateFormatter localizedStringFromDate:theNews.pubDate dateStyle:NSDateFormatterNoStyle timeStyle:NSDateFormatterShortStyle]; - theCell.titleView.text = theNews.title; + theCell.titleLabel.text = theNews.title; return theCell; } diff --git a/CSNCensorNetUaProject/Sources/CSNCommonFunctions.h b/CSNCensorNetUaProject/Sources/CSNCommonFunctions.h new file mode 100644 index 0000000..8df4651 --- /dev/null +++ b/CSNCensorNetUaProject/Sources/CSNCommonFunctions.h @@ -0,0 +1,15 @@ +// +// CSNCommonFunctions.h +// CSNCensorNetUaProject +// +// Created by Dmytro Omelchuk on 4/7/15. +// Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. +// +//////////////////////////////////////////////////////////////////////////////// + +#ifndef CSNCensorNetUaProject_CSNCommonFunctions_h +#define CSNCensorNetUaProject_CSNCommonFunctions_h + +NSString *CSNPathToStoredFileFromURLString(NSString *anURLString); + +#endif diff --git a/CSNCensorNetUaProject/Sources/CSNCommonFunctions.m b/CSNCensorNetUaProject/Sources/CSNCommonFunctions.m new file mode 100644 index 0000000..ca613c3 --- /dev/null +++ b/CSNCensorNetUaProject/Sources/CSNCommonFunctions.m @@ -0,0 +1,19 @@ +// +// CSNCommonFunctions.m +// CSNCensorNetUaProject +// +// Created by Dmytro Omelchuk on 4/7/15. +// Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. +// +//////////////////////////////////////////////////////////////////////////////// +#import "CSNCommonFunctions.h" + +//////////////////////////////////////////////////////////////////////////////// +NSString *CSNPathToStoredFileFromURLString(NSString *anURLString) +{ + NSString *theDirectory = [NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, + NSUserDomainMask, YES) lastObject]; + NSString *thePath = [theDirectory stringByAppendingFormat:@"/%@/%ld.jpg", + [[NSBundle mainBundle] bundleIdentifier], [anURLString hash]]; + return thePath; +} \ No newline at end of file diff --git a/CSNCensorNetUaProject/Sources/CSNDownloader.h b/CSNCensorNetUaProject/Sources/CSNDownloader.h index d446506..8347471 100644 --- a/CSNCensorNetUaProject/Sources/CSNDownloader.h +++ b/CSNCensorNetUaProject/Sources/CSNDownloader.h @@ -6,16 +6,12 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import //////////////////////////////////////////////////////////////////////////////// @interface CSNDownloader : NSObject + (instancetype)sharedDownloader; -/** - @return NSString with path to downloaded file -*/ -- (NSString *)addFileToDownloaderAtURL:(NSURL *)anURL; +- (void)addFileToDownloaderAtURL:(NSString *)anURL; @end diff --git a/CSNCensorNetUaProject/Sources/CSNDownloader.m b/CSNCensorNetUaProject/Sources/CSNDownloader.m index 986d36f..c247767 100644 --- a/CSNCensorNetUaProject/Sources/CSNDownloader.m +++ b/CSNCensorNetUaProject/Sources/CSNDownloader.m @@ -45,13 +45,14 @@ - (instancetype)init return self; } -- (NSString *)addFileToDownloaderAtURL:(NSURL *)anURL +- (void)addFileToDownloaderAtURL:(NSString *)anURL { - NSString *thePathToFile = [self pathToDownloadedFileAtURL:anURL]; + NSString *thePathToFile = CSNPathToStoredFileFromURLString(anURL); if (![[NSFileManager defaultManager] fileExistsAtPath:thePathToFile]) { - NSURLSessionDownloadTask *theTask = [self.session downloadTaskWithURL:anURL + NSURLSessionDownloadTask *theTask = [self.session + downloadTaskWithURL:[NSURL URLWithString:anURL] completionHandler:^(NSURL *aLocation, NSURLResponse *aResponse, NSError *anError) { if (nil != anError) @@ -69,7 +70,7 @@ - (NSString *)addFileToDownloaderAtURL:(NSURL *)anURL { if (![theManager createDirectoryAtPath:[thePathToFile stringByDeletingLastPathComponent] - withIntermediateDirectories:NO + withIntermediateDirectories:YES attributes:nil error:&theError]) { #warning Handle error @@ -85,17 +86,8 @@ - (NSString *)addFileToDownloaderAtURL:(NSURL *)anURL }]; [theTask resume]; } - return thePathToFile; } -#pragma mark Private methods -- (NSString *)pathToDownloadedFileAtURL:(NSURL *)anURL -{ - NSString *theDirectory = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, - NSUserDomainMask, YES) lastObject]; - NSString *thePath = [theDirectory stringByAppendingFormat:@"/%@/%ld.jpg", - [[NSBundle mainBundle] bundleIdentifier], [anURL hash]]; - return thePath; -} +#pragma mark - Private methods @end diff --git a/CSNCensorNetUaProject/Sources/CSNNews.h b/CSNCensorNetUaProject/Sources/CSNNews.h index fe95077..183df8b 100644 --- a/CSNCensorNetUaProject/Sources/CSNNews.h +++ b/CSNCensorNetUaProject/Sources/CSNNews.h @@ -6,7 +6,6 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import #import //////////////////////////////////////////////////////////////////////////////// @@ -19,7 +18,7 @@ @property (nonatomic, copy) NSDate *pubDate; @property (nonatomic, copy) NSString *comments; @property (nonatomic, copy) NSString *enclosure; -@property (nonatomic, copy) NSString *imagePath; +@property (nonatomic, readonly) NSString *imagePath; @property (nonatomic, copy) NSString *content; @end diff --git a/CSNCensorNetUaProject/Sources/CSNNews.m b/CSNCensorNetUaProject/Sources/CSNNews.m index 3356f78..b4205e1 100644 --- a/CSNCensorNetUaProject/Sources/CSNNews.m +++ b/CSNCensorNetUaProject/Sources/CSNNews.m @@ -11,17 +11,11 @@ //////////////////////////////////////////////////////////////////////////////// @implementation CSNNews -@dynamic title, link, details, guid, pubDate, comments, enclosure, imagePath, content; +@dynamic title, link, details, guid, pubDate, comments, enclosure, content; -- (NSString *)description +- (NSString *)imagePath { - return [NSString stringWithFormat:@"News: %@\nPublication date: %@\nDetails: " - "%@\nContent: %@\nPath to image: %@\nImage URL: %@\nLink: %@\n" - "Comments: %@\nPersistant link: %@", - self.title, [NSDateFormatter localizedStringFromDate:self.pubDate - dateStyle:NSDateFormatterMediumStyle timeStyle:NSDateFormatterMediumStyle], - self.details, self.content, self.imagePath, self.enclosure, - self.link, self.comments, self.guid]; + return CSNPathToStoredFileFromURLString(self.enclosure); } @end diff --git a/CSNCensorNetUaProject/Sources/CSNNewsDetailsViewController.h b/CSNCensorNetUaProject/Sources/CSNNewsDetailsViewController.h index 4b94e66..6c03535 100644 --- a/CSNCensorNetUaProject/Sources/CSNNewsDetailsViewController.h +++ b/CSNCensorNetUaProject/Sources/CSNNewsDetailsViewController.h @@ -6,7 +6,6 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import //////////////////////////////////////////////////////////////////////////////// @class CSNNews; diff --git a/CSNCensorNetUaProject/Sources/CSNPrefixHeader.pch b/CSNCensorNetUaProject/Sources/CSNPrefixHeader.pch new file mode 100644 index 0000000..116214a --- /dev/null +++ b/CSNCensorNetUaProject/Sources/CSNPrefixHeader.pch @@ -0,0 +1,22 @@ +// +// CSNPrefixHeader.pch +// CSNCensorNetUaProject +// +// Created by Dmytro Omelchuk on 4/7/15. +// Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. +// +//////////////////////////////////////////////////////////////////////////////// + +#ifndef CSNCensorNetUaProject_CSNPrefixHeader_pch +#define CSNCensorNetUaProject_CSNPrefixHeader_pch + +#ifdef __OBJC__ + + #import + #import + +#endif + +#import "CSNCommonFunctions.h" + +#endif diff --git a/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.h b/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.h index 5882fde..af1dcc6 100644 --- a/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.h +++ b/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.h @@ -6,7 +6,6 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import //////////////////////////////////////////////////////////////////////////////// extern NSString *const kTitleName; @@ -17,7 +16,6 @@ extern NSString *const kPubDateName; extern NSString *const kCommentsName; extern NSString *const kContentName; extern NSString *const kEnclosureName; -extern NSString *const kImagePathName; //////////////////////////////////////////////////////////////////////////////// @interface CSNXMLParserOperation : NSOperation diff --git a/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.m b/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.m index 1aab18d..6771b74 100644 --- a/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.m +++ b/CSNCensorNetUaProject/Sources/CSNXMLParserOperation.m @@ -21,7 +21,6 @@ NSString *const kContentName = @"content"; NSString *const kEnclosureName = @"enclosure"; NSString *const kURLName = @"url"; -NSString *const kImagePathName = @"imagePath"; //////////////////////////////////////////////////////////////////////////////// @interface CSNXMLParserOperation () @@ -128,11 +127,11 @@ - (void)parser:(NSXMLParser *)aParser didStartElement:(NSString *)anElementName else if (nil != self.currentNews && [anElementName isEqualToString:kEnclosureName]) { NSString *theURL = anAttributeDictionary[kURLName]; - if (nil != theURL) + if ([theURL containsString:@"censor_news_small"]) { self.currentNews[kEnclosureName] = theURL; - self.currentNews[kImagePathName] = [[[CSNDownloader sharedDownloader] - addFileToDownloaderAtURL:[NSURL URLWithString:theURL]] copy]; + [[CSNDownloader sharedDownloader] + addFileToDownloaderAtURL:theURL]; } } diff --git a/CSNCensorNetUaProject/main.m b/CSNCensorNetUaProject/main.m index 3b09d71..9a525e8 100644 --- a/CSNCensorNetUaProject/main.m +++ b/CSNCensorNetUaProject/main.m @@ -6,7 +6,6 @@ // Copyright (c) 2015 Dmytro Omelchuk. All rights reserved. // //////////////////////////////////////////////////////////////////////////////// -#import #import "AppDelegate.h" ////////////////////////////////////////////////////////////////////////////////