ios - iOS Swift Parse Local Data Store unpin doesn't work when offline
问题描述
This is not a pointer object issue the unpin seems to only fail when device is offline (not connected to internet)
Query:
let query = PFQuery(className: "Test")
query.fromLocalDatastore()
query.findObjectsInBackground { (objects, error) in
if let objects = objects {
print(objects)
}
}
Save:
let newTest = PFObject(className: "Test")
newTest["info"] = "Test"
newTest.pinInBackground()
newTest.saveEventually()
I tried saving while online and offline - I thought maybe I couldn't unpin it until it reaches the server however it doesn't unpin from local either way
Unpin / delete:
newTest.unpinInBackground()
newTest.deleteEventually()
I tried removing the delete eventually thinking maybe it had to stay pinned until it was successfully deleted from server however this too didn't change the results
When I call unpinInBackground in a block with a completion it returns as successfully unpinned however when I perform the local query the object still returns
I tried using the .unpin() with a try/catch - same results
When internet is restored and app is restarted all changes sync and both the local datastore and cloud database have the correct data
Is this the expected behavior? Is it not possible to unpin from local when offline?
When I run this code with the device connected to internet the whole time it works perfectly as expected
I am testing on the Simulator iOS 14.1 - xCode 112.1 - and have not yet tested on a physical device
I'm on Parse iOS SDK 19.0.0 - Parse Server 3.7.2
解决方案
推荐阅读
- java - 在开始时加载 SQL 数据
- amazon-web-services - 通过 NodeJS 在 AWS Lambda 上使用量角器
- c - 在C中的函数中传递不同的数据成员
- video - h264 提取帧仅适用于某些操作系统/ffmpeg 版本
- javascript - 单击时可调整大小的侧边导航展开
- python - 即使 runtime.txt 正确,使用 $ git push heroku master 时也会出错
- javascript - 访问数组列表中的对象
- python - 如何获取条目文本并显示在另一个条目中?
- python - 在包含字典作为元素的列表中追加和添加元素
- java - 提取XML中多个出现标签的值