How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site. Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask Pete Your Own Question
Pete, Computer Engineer
Category: Programming
Satisfied Customers: 17936
Experience:  Over 16 years of experience in computer programming.
Type Your Programming Question Here...
Pete is online now
A new question is answered every 9 seconds

Swift Code using CloudKit and Xcode Getting an error message

Customer Question

Swift Code using CloudKit and Xcode
Getting an error message on line "let newBug = Bug()" saying Unresolved identifier "Bug"
import UIKit
import CloudKit
class ViewController: UITableViewController {
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
let container = CKContainer.defaultContainer()
let publicData = container.publicCloudDatabase
let query = CKQuery(recordType: "Bug", predicate: NSPredicate(format: "TRUEPREDICATE", argumentArray: nil))
publicData.performQuery(query, inZoneWithID: nil) { results, error in
if error == nil { // There is no error
for bug in results {
let newBug = Bug()
newBug.title = bug["Title"] as! String
newBug.description = bug["Description"] as! String
dispatch_async(dispatch_get_main_queue(), { () -> Void in
else {
func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.
Submitted: 2 years ago.
Category: Programming
Expert:  Pete replied 2 years ago.
I am Pete, and I'll be happy to assist with your question today.
The only problem I can see is you are using both 'bug' and 'Bug' - try using the same case for all instances and let me know if that resolves the issue.