ios - 保存 Parse PFInstallation 对象时缺少字段

标签 ios xcode parse-platform

我在 application:didFinishLaunchingWithOptions 中保存一个 PFInstallation 对象——我不是询问用户推送权限或任何与 deviceToken 相关的事情——我发现许多标准字段未填充,包括:

  • 应用标识符
  • 应用版本
  • 应用名称
  • 角标(Badge)
  • 解析版本
  • 时区

(这些列在数据浏览器中未定义,不会显示在 PFInstallation 对象的 NSLog 上。)

  • deviceType 确实被填充

我正在抓取并成功将 deviceModel 和 deviceOS 保存到两个自定义列中。但我对为什么上述列未定义感到有点困惑。

代码如下:

[Parse setApplicationId:PARSE_APPID_DEV
              clientKey:PARSE_CLIENTKEY_DEV];

// record device model and OS
NSString *model = [self getDeviceModelAndNumber]; // via sys/utsname.h
NSString *sysVersion = [[UIDevice currentDevice] systemVersion];

PFInstallation *currentInstallation = [PFInstallation currentInstallation];
PFUser *loggedUser = [PFUser currentUser];
if (loggedUser)
    [currentInstallation setObject:loggedUser forKey:@"user"];

[currentInstallation setObject:model forKey:@"deviceModel"];
[currentInstallation setObject:sysVersion forKey:@"deviceOS"];
NSLog(@"installation: %@", currentInstallation);
[currentInstallation saveInBackground];

这个项目是在 Xcode 6 中创建的。在一个不同的项目中,在 Xcode 5 中创建,我基本上做同样的事情,并且正确地填充和保存了列。

还有其他人遇到过这个吗?我用谷歌搜索了很多但没有找到解决方案。非常感谢任何帮助。

最佳答案

经过多次实验,似乎(显着地)将最后一行更改为

[currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    // some logging code here
}];

解决问题。所以我想我应该用 Parse 提交一个错误。 (其实已经有一个打开了:https://developers.facebook.com/bugs/712949858787516/)

关于ios - 保存 Parse PFInstallation 对象时缺少字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26691295/

相关文章:

ios - iPhone 上的粘滞按钮程序

ios - GCD/NSOperationQueue EXC_BAD_ACCESS

ios - Swinject:如何将委托(delegate)模式与接口(interface)隔离(类与接口(interface))结合使用?

xcode - 在 Mac 上使用 OpenGL ES 函数

swift - 使用 performSegue View 时停止重新加载 webview

ios - 角色在 Scenekit 中没有朝正确的方向移动

ios - Xcode 不显示崩溃/错误输出

iOS 应用程序在解析异步查询期间卡住

xcode - 在同一个 ViewController 中使用 textView 和 ScrollView 不起作用? swift

ios - 如何检索不是当前用户的 PFUser 的电子邮件?