diff --git a/Sources/Classes/RSDefaultsPersistence.m b/Sources/Classes/RSDefaultsPersistence.m index a63db911..523d90c5 100644 --- a/Sources/Classes/RSDefaultsPersistence.m +++ b/Sources/Classes/RSDefaultsPersistence.m @@ -10,11 +10,11 @@ #import "RSLogger.h" #import "RSDefaultsPersistence.h" -@implementation RSDefaultsPersistence - static RSDefaultsPersistence *instance; static NSString * const userDefaultsCopied = @"userDefaultsCopied"; +@implementation RSDefaultsPersistence + + (instancetype)sharedInstance { if(instance == nil) { static dispatch_once_t onceToken; diff --git a/Sources/Classes/RSUtils.m b/Sources/Classes/RSUtils.m index aee9bc47..e29ded6c 100644 --- a/Sources/Classes/RSUtils.m +++ b/Sources/Classes/RSUtils.m @@ -58,7 +58,11 @@ + (BOOL)isFileExists:(NSString *)fileName { } + (BOOL)doesFileExistsAtURL:(NSURL *)fileURL { - return [[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]; + NSString* filePath = [fileURL path]; + if(filePath != nil) { + return [[NSFileManager defaultManager] fileExistsAtPath:filePath]; + } + return NO; } + (BOOL)removeFile:(NSString *)fileName {