Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Cancel Local Notification

Cancel all local notifications with this code:
[[UIApplication sharedApplication] cancelAllLocalNotifications];

Cancel one local notification with this line of code:
[[UIApplication sharedApplication] cancelLocalNotification:theNotification];

Delete a File in Documents Directory

iPhone SDK Tips & Tricks

To access the secondary directory in the documents directory:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectoryPath = [paths objectAtIndex:0];
NSString *secondaryDirectoryPath = [documentsDirectoryPath stringByAppendingPathComponent:@"secondary"];
NSString *databaseFile = [secondaryDirectoryPath stringByAppendingPathComponent:@"database.db"];
NSFileManager *fileManager = [NSFileManager defaultManager];
[fileManager removeItemAtPath:databaseFile error:NULL];