如何清除 Parse.com 上的声音数据?

How to clean sound data on Parse.com?

在 Parse.com,在 Class 我有一列是音频数据。 我的问题是: 当我删除行(使用云功能)时,音频数据是否会自动完全删除? 或者我是否需要做一些特殊的事情(之前或之后)来清除音频数据?

为了使上下文更清楚,这里是我用来上传声音数据的代码:

    PFFile *parse_Sound;
    NSData *soundData = [NSData dataWithContentsOfURL:myURL];
    parse_Sound = [PFFile fileWithName:@"VOICE"
                                  data:soundData];
    [parse_Sound saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        ……….
    }];

及以后:

    parse_Object = [PFObject objectWithClassName:@"PeraSentence"];
    [parse_Object setObject:parse_Sound forKey:@"AUDIO"];
    ………

这取决于您将其存储在 Parse 中的方式。如果您将它作为数据存储在列中,那么它与该行同生同死。删除您删除数据的行。

如果您使用的是解析文件,那么您的行仅包含指向文件的指针,删除该行并删除指针,但文件仍然存在。与指向其他记录的指针的概念相同。

当您删除一行时,文件不会被删除。您需要进入“设置”>“常规”并单击 "Clean Up Files" 按钮。

您的数据库中所有未被指针引用的文件都将被删除。

As you know, files can be referenced to from file-type columns in your objects. They can be pointed to in this manner by one or many different objects, and so they are not deleted automatically when any of the objects that refer to them are deleted. The Clean Up job will delete any files that have no such references to them.

As a safeguard, any files uploaded in the previous hour won't be deleted, regardless of how many objects point to them. This provides a grace period to avoid deleting a file that was recently uploaded but your app has not added a reference to it.

This Clean Up job should be used carefully. If your app is not using the file-type column to refer to files, and instead is copying the CDN URL to a string-type column, this will not count as a reference and the file will be deleted if it has no other file-type pointers to it.

来源:https://parse.com/questions/clean-up-files