Skip to content

查询 _File 表返回的对象强制转换成 AVFile 问题 #513

Description

@SXiaoXu

下面这样 query 查到的是 AVObject,没有转换为AVFile,像下面这样强转会崩溃报错找不到对象。

  AVQuery *query = [AVQuery queryWithClassName:@"_File"];
   [query findObjectsInBackgroundWithBlock:^(NSArray objects, NSError error) {
     
       AVFile *file =[objects firstObject];
        [file deleteWithCompletionHandler:^(BOOL succeeded, NSError * _Nullable error) {
        }];
    }];

使用的时候还需像下面这样转换一下。

        AVObject *obj =[objects firstObject];
        AVFile *file = [AVFile fileWithAVObject:obj];
        [file deleteWithCompletionHandler:^(BOOL succeeded, NSError * _Nullable error) {
        }];

不清楚 SDK 就是这样设计的,还是 SDK 的 Bug。 @zapcannon87

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions