无法将频道保存到PFS安装(iOS)

无法将频道保存到PFS安装(iOS),ios,objective-c,parse-platform,Ios,Objective C,Parse Platform,我正在尝试从PFInstallation中添加/删除频道,但始终收到相同的错误消息: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Operation is invalid after previous operation.' 我的代码: NSString * channel=[NSString stringWithFormat:@"%@%@%@", city,

我正在尝试从PFInstallation中添加/删除频道,但始终收到相同的错误消息:

   Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Operation is invalid after previous operation.'
我的代码:

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];

当通道为nil时,addUniqueObject方法中存在错误。 你应该在它之前加上这个

if (currentInstallation.channels == nil)
{
    currentInstallation.channels = [[NSArray alloc] init];
}
此外,您应该使用savefinally而不是saveInBackGround


这应该是SDK中的一个bug。

谢谢!你救了我!:)