@@ -166,11 +166,16 @@ - (void)setDBPath:(NSString *)filePath
166
166
NSString *dirPath = [filePath substringToIndex: lastComponent.location];
167
167
BOOL isDir = NO ;
168
168
BOOL isCreated = [fileManager fileExistsAtPath: dirPath isDirectory: &isDir];
169
-
169
+
170
170
if ((isCreated == NO ) || (isDir == NO )) {
171
171
NSError *error = nil ;
172
+ #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
173
+ NSDictionary * attributes = @{NSFileProtectionKey :NSFileProtectionNone };
174
+ #else
175
+ NSDictionary * attributes = nil ;
176
+ #endif
172
177
BOOL success = [fileManager createDirectoryAtPath: dirPath withIntermediateDirectories: YES
173
- attributes: @{ NSFileProtectionKey : NSFileProtectionNone } error: &error];
178
+ attributes: attributes error: &error];
174
179
175
180
if (success == NO ) {
176
181
LKErrorLog (@" create dir error: %@ " , error.debugDescription );
@@ -182,7 +187,9 @@ - (void)setDBPath:(NSString *)filePath
182
187
* @brief Disk I/O error when device is locked
183
188
* https://github.com/ccgus/fmdb/issues/262
184
189
*/
190
+ #ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
185
191
[fileManager setAttributes: @{NSFileProtectionKey :NSFileProtectionNone } ofItemAtPath: dirPath error: nil ];
192
+ #endif
186
193
}
187
194
}
188
195
@@ -195,11 +202,12 @@ - (void)setDBPath:(NSString *)filePath
195
202
196
203
self.bindingQueue = [[FMDatabaseQueue alloc ]initWithPath:filePath
197
204
flags: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FILEPROTECTION_NONE];
198
-
205
+ # ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
199
206
if ([fileManager fileExistsAtPath: filePath])
200
207
{
201
208
[fileManager setAttributes: @{NSFileProtectionKey :NSFileProtectionNone } ofItemAtPath: filePath error: nil ];
202
209
}
210
+ #endif
203
211
204
212
_encryptionKey = nil ;
205
213
0 commit comments