[英]Using Parse in replace of a Constants.h file
我正在构建一个使用很多常量的应用程序,这些常量通常不会更改,这些都是UUID,其中有些信息可能会更改。 不过,这将由我们的硬件人员来驱动。
我曾考虑使用parse替换Constants.h文件,但是在有限的测试中,当不存在网络连接时,我无法从localstore获取数据。
我要做什么甚至有可能吗?
是否有在线静态密钥副本可以同步到本地存储以供离线使用?
我尝试过的
PFQuery *query = [PFQuery queryWithClassName:className];
[query getObjectInBackgroundWithId:objectId
block:^(PFObject *cloudUpdate, NSError *error) {
cloudUpdate[settingsName] = updateValue;
[cloudUpdate pinInBackground];
[cloudUpdate saveEventually];
}];
要检索它:
PFQuery *query = [PFQuery queryWithClassName:@"Settings"];
[query fromLocalDatastore];
[query getObjectInBackgroundWithId:@"xWMyZ4YEGZ" block:^(PFObject *settings, NSError *error) {
NSLog(@"%@", settings);
}];
我试过使用fromLocalDataStore。 我已删除固定的对象,然后再次尝试。
我的项目设置正确,我的appdelegate中启用了本地数据存储,并安装了libsqlite3。
我只是使用用户默认值。 一个简单的配置,用于初始注册内置/硬编码值,并定期运行查询以更新它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.