【问题标题】:Parse Won't Save Installation, Error: badge must be a non-negative integer解析不会保存安装,错误:徽章必须是非负整数
【发布时间】:2014-08-25 21:00:25
【问题描述】:

我的问题似乎与这个问题几乎相同,但从未解决:

https://www.parse.com/questions/installation-not-created

当我从 Parse 数据浏览器中删除所有安装时,它开始了(坏主意,我现在知道了)。现在的问题是它不会从我的(真实)测试设备之一保存任何新安装,大概是因为这个令人困惑的错误:

Error: badge must be a non-negative integer: -3 (Code: 111, Version: 1.2.20)

当我尚未对徽章编号执行任何操作时,会在全新安装时发生这种情况。更复杂的是,Parse 保存来自其他(真实)设备和模拟器的安装。作为参考,这是我尝试在 AppDelegate.m 中保存安装的方式:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    // Store the deviceToken in the current installation and save it to Parse.
    PFInstallation *currentInstallation = [PFInstallation currentInstallation];
    [currentInstallation setDeviceTokenFromData:deviceToken];
    [currentInstallation saveInBackground];
}

有什么想法吗?

【问题讨论】:

    标签: ios objective-c parse-platform


    【解决方案1】:

    我仍然不知道为什么会出现这个错误,但是解决方法似乎是插入以下代码行,然后在安装后将其删除:

    [[PFInstallation currentInstallation] setBadge:0];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-05-11
      • 1970-01-01
      • 2016-08-17
      • 1970-01-01
      • 1970-01-01
      • 2021-11-10
      相关资源
      最近更新 更多