如何为Azure演示iOS应用程序向Easy Table添加列(Todo列表) [英] How to Add Columns to Easy Table for Azure Demo iOS App (Todo List)

查看:66
本文介绍了如何为Azure演示iOS应用程序向Easy Table添加列(Todo列表)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次与Azure合作,我只是想制作一个演示iOS应用(Todoitem列表).

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

我遵循了官方教程中的每个步骤(下一个步骤),并得到了一个名为"TodoItem"的简易表,其中包含7个字段(id,createdAt,updatedAt,version,delete,complete,text).

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 ://docs.microsoft.com/zh-CN/azure/app-service-mobile/app-service-mobile-ios-get-started

我下载了iOS应用程序,并且列表中显示了表中字段"text"的所有值,效果很好.

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

然后,我从azure中添加了一个名为"mac"的新列,并在iOS项目中自定义了一些代码,以便在从iOS应用程序插入数据时将固定值设置为"mac".

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)
        }
    }
}

但是字段"mac"保持为空是行不通的.当我将列表中的显示字段从文本"更改为"mac"时,如下所示,我收到了一个错误消息,即"signal SIGABART".

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?

推荐答案

我收到一个称为"signal SIGABART"的错误

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.

这篇关于如何为Azure演示iOS应用程序向Easy Table添加列(Todo列表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆