iOS parse.com 推送错误

标签 ios arrays dictionary error-handling parse-platform

我有一个字符串数组,我试图将其保存以解析为推送通知的 channel 。数组是正确的,我不知道发生了什么。有人可以对此有所了解吗?谢谢。

错误:

Error: Bad channel name: TestString123 (Code: 112, Version: 1.1.30)

代码:

- (void)saveSelectedDepartmentsToParse:(NSMutableDictionary *)dictionary {

    NSArray *array = [dictionary allKeysForObject:@"YES"];

    NSLog(@"Array = %@", array);

    PFInstallation *currentInstallation = [PFInstallation currentInstallation];

    [currentInstallation addObjectsFromArray:array forKey:@"channels"];
    [currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {

        if (error == nil) {

            NSLog(@"Parse Save Succeeded");
        }
        else {

            NSLog(@"Parse Save Failed, %@", error.localizedDescription);
        }
    }];
}

最佳答案

原因是因为 Parse 不接受 channel 中的空格或任何特殊字符。去除所有空格和特殊字符后,操作成功。

关于iOS parse.com 推送错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14971705/

相关文章:

android - 向 ios 和 android 设备发送 Firebase 云消息

ios - 为什么没有调用 gameCenterViewControllerDidFinish?

ios - iOS Cordova 应用程序上的键盘响应缓慢

javascript - 如何返回字符串中子串的出现频率?

Javascript:根据属性值将对象数组拆分为具有动态名称的单独数组

javascript - 为什么我的 MinArray 实现不回收未使用的 id?

python - 替换嵌套数组中的多次出现

python - 有效地在字典列表中查找值

python - 如何将字典和数组保存在同一个存档中(使用 numpy.savez)

ios - 将自动布局与可变 View 一起使用