MagicGD
MagicGD

Reputation: 3

How to Add Columns to Easy Table for Azure Demo iOS App (Todo List)

It's my first time working with Azure and I was just trying to make a demo iOS app(the Todoitem List).

I followed every step in the official tutorial (the one below) and I got a Easy Table called "TodoItem" with 7 fields(id, createdAt, updatedAt, version, deleted, complete, text).

https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-ios-get-started

I downloaded the iOS app and it worked well that all the values of field "text" in the table was showed in the list.

Then I added the new column called "mac" from azure and customized some code in iOS project, in order to set a fixed value to "mac" when inserting data from the iOS app.

func didSaveItem(_ text: String) {
    if text.isEmpty {
        return
    }

    // We set created at to now, so it will sort as we expect it to post the push/pull

    // **Set fixed value to field "mac"**
    let itemToInsert = ["text": text, "complete": false, "mac":"xxxx:xxxx", "__createdAt": Date()] as [String : Any]

    UIApplication.shared.isNetworkActivityIndicatorVisible = true
    self.table!.insert(itemToInsert) {
        (item, error) in
        UIApplication.shared.isNetworkActivityIndicatorVisible = false
        if error != nil {
            print("Error: " + (error! as NSError).description)
        }
    }
}

But it doesn't work that the field "mac" stays empty. And when I changed the displayed field in the list from "text" to "mac" as below, I got an error called "signal SIGABART".

func configureCell(_ cell: UITableViewCell, indexPath: IndexPath) -> UITableViewCell {
    let item = self.fetchedResultController.object(at: indexPath) as! NSManagedObject

    // Set the label on the cell and make sure the label color is black (in case this cell
    // has been reused and was previously greyed out

    // **Change displayed field from "text" to "mac"**
    if let text = item.value(forKey: "mac") as? String {
        cell.textLabel!.text = text
    } else {
        cell.textLabel!.text = "?"
    }

    cell.textLabel!.textColor = UIColor.black

    return cell
}

I wonder if anybody here had any solutions to solve my problem?

Upvotes: 0

Views: 138

Answers (1)

Tom Sun
Tom Sun

Reputation: 24529

I got an error called "signal SIGABART"

Please have a try to clean the project. Go to MenuBar: Product -> Clean.
Then rebuild just click Run button.

Upvotes: 0

Related Questions