It has been some time since I posted to this site. I’ve been posting (although infrequently) to Facebook, but think I’ll come back to this and do posts here again. I can always push from here to Facebook.
I completely rewrote my “A Dose of Humor” app and it is not “Daily Dose of Humor”. The rewrite served two purposes:
- change from Objective-C to Swift. Swift is the new language (relatively new anyway) from Apple for iPhone development. Might as well keep up to date with the current language.
- secondly, the database back-end that I had used originally was done in Parse. Parse was a fantastic tool to quickly configure and use a cloud database. Parse was purchased by Facebook, and not too long after it was purchased it was announced that it would close down.
So, with the shutting down of Parse I had to find another cloud database back-end, and I chose to write this in CloudKit, which is Apple’s native cloud database backend.
So here we are, my new app has been released into the wild, check it in iTunes on the App Store.
View on App Store
I’d been having trouble populating a UITableView with the entire contents parse data in my iOS application. Come to find out that when using Parse and referencing the objectId field, that you need to use dot notation and not by referencing the field like the other ones.
So, use this: parseData.objectId
Instead of: parseData[@”objectId”]
Who’d have thunk it.
Same when adding to the local data store. I download the records from Parse and iterate through them to search the local data store. If found it should do nothing, if not found add it to the db. Because of the dot notation on the objectId field it would never find it because it search on <nil>. So the same records got added over and over again. All the other fields get added using the parseData[@”dataField”] type of reference, which threw me.
Finally, once I figured out to use parseData.objectId instead, it added it correct and found it the next time I launched it so there is only a single entry for it in the local db.
(it was at this point I laid my finger between my lips and made googly noises)
Now just have to format the cells in the table view, make the appropriate actions once the cell is tapped, and I am all done.
It is still a little slow at launch as it searches all the files and tables to add locally. I’ll have revisit that, maybe only pull down the file name or some other reference to make it speedier. It’s not horribly slow, but I would like it to be faster.