BLOG main image
for our next (37)
Dev (32)
Mac (1)
Windows (2)
FreeTalk (1)
Shell (1)
Private (0)
Visitors up to today!
Today hit, Yesterday hit
daisy rss
tistory 티스토리 가입하기!
2011. 11. 4. 01:26
// 파일의 존재 유무를 검사한다.
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"BountyHunter.sqlite"];
// 파일 존재 유무에 따라 없으면 복사하고 있으면 복사하지 않는다.
BOOL dbExists = [fileManager  fileExistsAtPath:[storeURL path]];
if ( !dbExists )
{
  // 파일이 없는 경우.
  NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"BountyHunter.sqlite"];
  NSError *error = nil;
  BOOL success = [fileManager copyItemAtPath:defaultDBPath toPath:[storeURL path] error:&error];
  if ( !success )
  NSAssert1(0, @"Failed to create writable database file with message '%@'", [error localizedDescription]);
}
  Copyright: http://teddevtalk.blogger.com 이 글은 저작자의 허락 없이 변경하거나 상업적인 목적으로 인용할 수 없습니다. 인용시 출처와 링크를 표기하여 주시기 바랍니다. 

'Dev > iOS' 카테고리의 다른 글

CFBundleVersion  (1) 2021.12.14
iOS Model 정보!  (0) 2012.05.10
In App Purchase : invalidProductIdentifiers  (1) 2011.01.14
App 안에 Store Link 달기  (0) 2011.01.10
[Xcode] Build and Archive  (1) 2010.12.22