Die*_*ego 5 devicetoken ios parse-platform
我遇到了我的iOS应用程序PFInstallation的奇怪行为.在每个应用程序启动时,我正在注册设备以接收推送通知并在方法上调用以下代码didRegisterForRemoteNotificationsWithDeviceToken:
PFInstallation *currentInstallation = [PFInstallation currentInstallation];
[currentInstallation setDeviceTokenFromData:deviceToken];
NSLog(@"%@", currentInstallation );
[currentInstallation saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (succeeded) {
NSLog(@"currentInstallation saved" );
}
if (error) {
NSLog(@"currentInstallation NOT saved" );
}
}];
Run Code Online (Sandbox Code Playgroud)
当我在iphone上安装应用程序时,使用deviceToken正确保存安装.我绝对相信前几天我通过Parse Dashboard手动删除了deviceToken(尝试一下)然后在app重新启动时,设备令牌再次正确保存.我正在使用的某些频道也是如此.今天没有保存deviceToken,也没有保存频道.saveInBackgroundWithBlock成功但deviceToken字段为空.currentInstallation的NSLog包含deviceToken,但它没有保存.在尝试理解这种行为的原因时,我发现如果我在此currentInstallation.deviceToken = @"";之后添加该行,PFInstallation *currentInstallation = [PFInstallation currentInstallation];则deviceToken会被正确保存.消费Parse guru向我解释为什么会发生这种情况以及为什么几天前它不是?我最近在这个应用程序上升级了Parse Framework,这可能是什么原因?
| 归档时间: |
|
| 查看次数: |
884 次 |
| 最近记录: |