我正在尝试从我调用的类方法中返回一个 bool 值,该类方法中有一个块。我收到错误,发送不兼容的块指针类型......我该如何解决这个问题?我只想知道我调用的类方法是否完成有或没有错误......
+ (BOOL)saveSelectedDepartmentsToParse:(NSMutableDictionary *)dictionary {
NSArray *array = [dictionary allKeysForObject:@"YES"];
NSMutableArray *trimmedArray = [[NSMutableArray alloc] init];
for (NSString *string in array) {
NSString *final = [string removeAllInvalidCharacters];
[trimmedArray addObject:final];
}
NSLog(@"Array = %@", trimmedArray);
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation removeObjectForKey:@"channels"];
[currentInstallation addObjectsFromArray:trimmedArray forKey:@"channels"];
[currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (error == nil) {
NSLog(@"Parse Save Succeeded");
[self saveDepartmentsDictionary:dictionary];
}
else {
NSLog(@"Parse Save Failed, %@", error.localizedDescription);
}
}];
}