【问题标题】:ios app crashes on fill cell with image literal only on ios 9 not clear crash logios 应用程序在填充单元格上崩溃,仅在 ios 9 上使用图像文字不清除崩溃日志
【发布时间】:2017-05-18 09:28:56
【问题描述】:

我有一个电子商务应用程序,可以查看用户的产品列表,并且在最新更新之后,我仅在 ios 9 上收到了很多来自 fabric crashlytics 的崩溃,我无法以任何方式复制测试时。

相关崩溃日志

0 libswiftUIKit.dylib 0x10166f218 _TToFE5UIKitCSo7UIImagecfT24imageLiteralResourceNameSS_S0_ + 224

1 libswiftUIKit.dylib 0x10166f040 _TFE5UIKitCSo7UIImageCfT24imageLiteralResourceNameSS_S0_ + 96

2 "AppName" 0x1000e7788 专用 ItemsSubCategoriesCell.fill(withInfo : ItemsSubCategory) -> () (ItemsSubCategoriesCell.swift:39)

3 "AppName" 0x1000b9b88 专用 ItemsSubCategoriesViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (ItemsSubCategoriesViewController.swift)

4 "AppName" 0x1000b91c4 @objc ItemsSubCategoriesViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (ItemsSubCategoriesViewController.swift)

相关代码块

func fill(withInfo info: ItemsSubCategory) {

    backgroundColor = info.primaryColor
    numberOfItemsLabel.text = "\(info.items.count)"
    discloseIndicatorImageView.image = #imageLiteral(resourceName: "Disclosure Indicator").withRenderingMode(.alwaysTemplate)
    discloseIndicatorImageView.tintColor = info.darkBackground ? UIColor.white : UIColor.gray

    if let imageURLString = info.photoFile?.url {
        sectionImageView.sd_setImage(with: URL(string: imageURLString)!)
    }
}

问题是,我试图在多台测试手机上复制此崩溃,我希望能提供任何指向崩溃可能原因的指针

编辑: 我尝试更改图像名称以删除空格,并尝试使用资源名称而不是使用 #imageliteral 的图像,并尝试在本地和测试飞行中对其进行测试,没有崩溃,推送到生产环境并且崩溃又回来了。

【问题讨论】:

  • 看起来它与您的图像文字有关。也许尝试让您的图像/资源名称不带空格? disclosure-indicator
  • 谢谢,会尝试,但我无法确认它是否能解决问题,因为我无法在测试环境中复制错误
  • 问题是图像字面力会打开图像。如果无法加载图像,则应用程序崩溃。问题是为什么无法加载图像。我什至认为 AppStore 做了一些糟糕的优化,但我们的应用在 Fabric 构建中也崩溃了。

标签: ios iphone swift uitableview


【解决方案1】:

这解决了我的问题

    backgroundColor = info.primaryColor
    numberOfItemsLabel.text = "\(info.items.count)"
    let tempImage = UIImage(named: "DisclosureIndicator")
    discloseIndicatorImageView.image = tempImage?.withRenderingMode(.alwaysTemplate)
    discloseIndicatorImageView.tintColor = info.darkBackground ? UIColor.white : UIColor.gray

我刚刚创建了一个 tempImage UIIMage 然后分配了它

【讨论】:

    猜你喜欢
    • 2015-12-29
    • 1970-01-01
    • 2014-09-27
    • 2014-07-01
    • 1970-01-01
    • 2022-08-12
    • 2018-01-09
    • 2018-05-09
    • 1970-01-01
    相关资源
    最近更新 更多