【发布时间】:2018-04-03 03:26:19
【问题描述】:
这是我第一次使用 Azure,我只是想制作一个演示 iOS 应用程序(待办事项列表)。
我按照官方教程中的每一步(如下),我得到了一个名为“TodoItem”的简单表,其中包含 7 个字段(id、createdAt、updatedAt、版本、删除、完整、文本)。
https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-ios-get-started
我下载了 iOS 应用程序,它运行良好,表格中“文本”字段的所有值都显示在列表中。
然后我从 azure 中添加了名为“mac”的新列,并在 iOS 项目中自定义了一些代码,以便在从 iOS 应用程序插入数据时将固定值设置为“mac”。
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”字段保持为空是行不通的。当我将列表中的显示字段从“text”更改为“mac”时,如下所示,我收到了一个名为“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 got an error called "signal SIGABART"。您是否尝试过清理项目去 MenuBar: Product -> Clean 然后重建只需单击 Run 按钮? -
我是 Xcode 的新手,我忘记清理项目了!重建后问题解决了,非常感谢!
标签: ios azure azure-sql-database azure-mobile-services