2013-07-11 30 views

回答

3

我想通了!这些文件存储在名为“收件箱”的文件夹的子文件夹中。你需要在那里删除它们。这里是代码:

NSString *fileName = @"afile.png"; 
    NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; 
    NSString *inboxDirectory = [documentsDirectory stringByAppendingPathComponent:@"Inbox"]; 
    NSString *filePath = [inboxDirectory stringByAppendingPathComponent:fileName]; 
    NSError *error; 
    BOOL success = [fileManager removeItemAtPath:filePath error:&error]; 
    if (!success) { 
     NSLog(@"error occured during removing the file"); 
    } 
+0

不要忘记你可以接受你自己的答案.... –

0

手动搜索收件箱在我看来不是一个很好的做法。如果我将文件发送到我的应用程序,则在完成处理后将其删除,或者稍后需要时将其移至缓存/临时目录以防止iCloud将其备份。

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool { 
    processUrl(url) 
    removeFileAt(url) 

    return true 
} 
相关问题