我如何删除xxxx.app目录中的文件

| 我有以下代码:
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *path1 = [[NSBundle mainBundle] pathForResource:@\"myFile\" ofType:@\"txt\"];

if([fileManager fileExistsAtPath:path1]) {
    NSLog(@\"-- sample file found --\");


    AccessQuestionsDB *accessQuestionDataFunction = [AccessQuestionsDB new];
    idCounter = [accessQuestionDataFunction populateTheDatabase: path1 theID:0 firstTime: YES];

    [accessQuestionDataFunction release];

    [fileManager removeItemAtPath:path1 error:NULL];

    if ([fileManager fileExistsAtPath:path1]) {
        NSLog (@\"Remove %@ successful\", path1);
    } else {
        NSLog (@\"Remove %@ failed\", path1);
    }

}
else {
    NSLog(@\"-- NO SAMPLE FILE! --\");
}
输出:
2011-06-13 21:41:04.471 xxxx[1726:707] Remove /var/mobile/Applications/B1CC3E09-2A1D-4CD7-976D-E190A238EC79/xxxx.app/myFile.txt successful
当我运行程序时,表明文件已删除,请参见上文,但不是。当我使用\“ iPhone Explorer \”进行检查时,文件仍然位于\“ xxxx.app \”目录中,我猜这是应用程序的根目录。 如果有人可以向我展示如何真正删除此文件,我将不胜感激,因为我需要将其删除。     
已邀请:
        一旦对.app捆绑包进行了签名并将其放置在设备上,便无法添加或删除文件。     
        您无法删除应用程序捆绑包中的文件。 也,
if ([fileManager fileExistsAtPath:path1]) {
    NSLog (@\"Remove %@ successful\", path1);
} else {
    NSLog (@\"Remove %@ failed\", path1);
}
之所以输出“删除成功”,是因为您在ѭ3when(即未删除它)时输出了该信息。     

要回复问题请先登录注册