【问题标题】:Some times alamofireImage did't load images有时 alamofireImage 没有加载图像
【发布时间】:2017-01-13 07:55:34
【问题描述】:

我用普通方法试过了

 winnerCell.challengeBannerURL.af_setImage(withURL:  URL(string: winnerchallengesData[indexPath.row].challengeDetails.challenge_banner_url)!)

它在正常通话中工作,但在 AlamofireImage 中不工作

let data = try? Data(contentsOf: URL(string: self.winnerchallengesData[indexPath.row].winnerDetails.profileURL)!)
//                winnerCell.userProfile.image = UIImage(data:data!)
//              

【问题讨论】:

  • 您可能想改用 SDWebImage 吗?

标签: ios swift alamofireimage


【解决方案1】:

来自服务器的数据是一个流,所以我必须在 AlamofireImage 中进行配置。

ImageResponseSerializer.addAcceptableImageContentTypes(["image/jpg","image/png","binary/octet-stream"])

【讨论】:

  • 嗨......你在哪里添加这个......请帮助我。我有一个请求的 api,我在其中获取 .jpg 图像。 AlamofireImage 不支持。你是怎么做到的?
  • 获取图片之前
【解决方案2】:

在将此设置添加到 info.plist 文件后(根据第三方广告实施的建议),我遇到了图像停止下载的情况;

NSAllowsArbitraryLoadsForMedia

删除它解决了这个问题。

【讨论】:

    猜你喜欢
    • 2016-03-06
    • 1970-01-01
    • 1970-01-01
    • 2014-09-26
    • 2017-01-19
    • 2016-09-28
    • 1970-01-01
    • 2017-09-18
    相关资源
    最近更新 更多