Skip to content

AVInstallation removeObjectForKey 后再次 save 同样的内容,save 不成功 #52

@nicecui

Description

@nicecui

问题详情

先订阅两个频道,再清空订阅,再订阅同样的两个频道,代码返回了成功,但是数据并没有被存到服务端,提示:Object not changed, ignore save request.

重现代码

比较奇怪的是,最后一次 saveInBackground 时,如果我打了断点,等一会再去 save,那么这个问题百分百重现,如果我不打断点,这个问题有的时候正常,有的时候可以重现。

    AVInstallation *currentInstallation = [AVInstallation currentInstallation];
    // 订阅
    NSArray *array=[[NSArray alloc]initWithObjects:@"001",@"002", nil];
    [currentInstallation setChannels:array];
    [currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
        // 取消订阅
        [currentInstallation removeObjectForKey:@"channels"];
        [currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
            // 再次订阅
            [currentInstallation setChannels:array];
            [currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {

            }];
        }];

    }];

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions