Closed swiftsrl closed 7 years ago
I think this might be an issue because of the version of iOS that is being used. Are you using 10.2 when you build a new project?
yes 10.2
Okay, I will make a new project and see what the issue is, and if there is one, I will fix it right away :) Thanks for sharing this.
hello Daniel news about that?
Yes, sorry. I was caught up in some other issues. I will take a look at this today, and aim to have an update by the end of the week, if not earlier. Thank you!
Hey, so I have tested this out again and all seems to work. I am not sure what if going on with your project. Can you verify in any way that iCloud is working for you?
I am currently able to sync data between my iPhone 6s and iPad Pro using 10.2.1.
here are the steps:
db = Graph(cloud: "FantasyName")
let record = Entity(type: "Names")
record["name"] = name
db.sync()
let search = Search<Entity>(graph: self.db).for(types: ["Names"])
self.storage = search.sync(completion: nil)
Are you doing these steps after the graphDidPrepareCloudStorage
call?
yes, just tried this:
func graphDidPrepareCloudStorage(graph: Graph) {
debugPrint("graphDidPrepareCloudStorage")
self.addName("Apple")
self.addName("Google")
}
the func:
func addName(_ name:String) {
let record = Entity(type: "Names")
record["name"] = name
db.sync()
let search = Search<Entity>(graph: self.db).for(types: ["Names"])
self.storage = search.sync(completion: nil)
self.lc?.tableView.reloadData()
}
but the search result is always empty....
Okay, the best bet is to send me a sample with it not working, or what you have, and then I can test it. I need to see what is happening here. Thank you!
ok, this is the test GraphCloudTest.zip
Thank you, I will look at this in a few hours :)
Thanks to one of my students I found the bug:
let record = Entity(type: "Names", graph: self.db)
let record = Entity(type: "Names")
see you next trouble :)Yes, that is correct. Because the Entity doesn't know which Graph you are referencing and without it specified, it goes to the default local Graph. Sorry, I didn't catch this earlier.
Just make a new project, turn on iCloud, make an instance of Graph using the cloud init (where is not clear the purpose of the string you have to pass), make a new record and save the db, and finally setup a search, run it and you'll see the returned array is always empty