我正在尝试从 PFInstallation 添加/删除通道,但我不断收到相同的错误消息:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Operation is invalid after previous operation.'
My code:
NSString * channel=[NSString stringWithFormat:@"%@%@%@", city, @"_", self.titleLabel.text];
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
if([sender isOn]){
[currentInstallation addUniqueObject:channel forKey:@"channels"];
} else{
[currentInstallation removeObject:channel forKey:@"channels"];
}
[currentInstallation saveInBackground];
当通道为零时,addUniqueObject 方法存在错误。
你应该在它之前添加这个。
if (currentInstallation.channels == nil)
{
currentInstallation.channels = [[NSArray alloc] init];
}
另外,您应该使用 saveEventually 而不是 saveInBackGround。
这应该是SDK的一个bug。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)