Kodeco Forums

CloudKit Tutorial: Getting Started

In this CloudKit tutorial, you'll learn how to add and query data in iCloud from your app, as well as how to manage that data using the CloudKit dashboard.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1000-cloudkit-tutorial-getting-started

FYI, it seems you have 2 instances of html encoding errors in your code blocks. Seems like the forums automatically parse the html encoding, so you should see them in BOLD below.

and

I think maybe the introduction should be amended to exclude ā€œfor iOS-only applicationsā€. Albeit not within the scope of this specific tutorial, CloudKit can be used for web and server applications. Of course, the CloudKit guidelines do in some ways require an iOS client to be available in order to use the services on other platforms.

But the current wording might discourage some from considering CloudKit as a backend option for their data-driven apps, which makes me sad because Iā€™ve loved using CloudKit for creative and on-the-fly solutions that would otherwise have taken me hours to build.

Thanks for the note, but Iā€™m not seeing the errors.

Good suggestion. I amended the intro.

I have 6 errorsā€¦
Expected declaration
unresolved identifier ā€œEstablishment typeā€
unresolved identifier public db
unresolved identifier "Note type

unresolved identifier "private db

/Users/timvogt/Downloads/BabiFud-Cloudkit-Starter/BabiFud/Establishment.swift:76:11: Value of type ā€˜Modelā€™ has no member ā€˜fetchNoteā€™

Sofar almost non of the tutorials went without errors dos successful build yet after week of testingā€¦;-(

I get this error^ what should I do with it? Thanks!

Thanks for the awesome tutorial, which is the very one for my first CloudKit App.
And I got some questions after looking through each line of codes:

  1. In MapViewController
    // This works for the US hemisphere.
    let upperLeft = CLLocationCoordinate2DMake(region.center.latitude - region.span.latitudeDelta,
    region.center.longitude + region.span.longitudeDelta)
    Should Delta be Delta/2 for upperLeft?

  2. Use AccountStatus to check whether user has logged into iCloud before write data to it?

I have two errors in the sample code unchanged. I am using Xcode 8 and targeting Swift 3. First: Inheritance from non-protocol type ā€˜DarwinBooleanā€™ occurs in Establishment.swift, NotesCell.swift, NotesTableViewController.swift and DetailViewController.swift. Second: Cannot convert value of type ā€˜((CKRecord)?, NSError) ā†’ ()ā€™ to expected argument type '((CKRecord)?, NSError?)->() in NotesTableViewController.swift . There are also two warnings: 'global(priority:) was deprecated; ā€˜backgroundā€™ was deprecated in iOS8.0. Use qos attributes instead. Both from DetailViewController.swift

Question about CloudKit: How do you localized your data ? Does it means you have to create a separate record type to hold all the translation ?

thanks

alex

I have question about record types, can I create and delete record types through program in production environment, I am aware that I can do it in development environment but I am not sure about production.

This is now updated for Swift 3 so all those issues are resolved now. Also, the text is also corrected so thereā€™s no longer and HTML characters being rendered. Thanks!

When I try to run the app, Get this message ā€œCould not determine iCloud Statusā€. i am logged into iCloud in Settings on both my iPhone and the simulator. Where can I place a breakpoint so I can see what error code is being returned?
Thanks

I get the following ā€œ[Generic] Creating an image format with an unknown type is an errorā€ when trying to update the image

any ideas, looks like IOS 10 issue

Great tutorial, thanks.

Iā€™m not getting the map to zoom to location and show the establishments. Was that meant to be implemented. Otherwise everything is working as expected. Thanks.

I have a generic question about CloudKit. Iā€™m getting an app rejected by Apple because:

  1. Iā€™m checking to see if someone is logged in ā€“ i.e. can create a container.

  2. Iā€™m not allowed to push people to use iCloud ā€“ their argument is that people may not have or want an iCloud account.

Has anyone else experienced this? and is there a workaround.

Thanks

If nothing happens when you run the app, or you get a message in the logger like ā€œunable to verify SuchAndSuch existsā€ , then chances are you have the very top left container selected ( The White Tile Icon at the top of the leftmost black panel ) is your default developer container.

You may have set the record types and records under this. Click it and it becomes a drop Down Menu ( even though it has a downward caret v , Apple still makes UI an exercise of puzzle solving ).

The container that XCode created should be in a list that drops down.
And No, definitely NO, you canā€™t delete or rename any mess of redundant containers created.
Not at this time of writing, though it is flagged.

see my post about 4 down from here. Sounds similar.

Hi guys,

Can anyone please provide the best practice on how to manage offline caching when using CloudKit.
In the last part of the article, it says:
ā€œProvide caching and synchronization so the app remains responsive offline and keeps the content up to date when it reconnects to a network.ā€