图像未加载到 AsyncImageView 中
Image not being loaded in AsyncImageView
我刚刚更新到 Xcode 7 和 Swift 2.0,当然它在我的应用程序中引起了一些问题。我已经解决了很多问题,但我正在为这个问题而苦苦挣扎。
在我的 table 视图中,我正在从 Parse.com 加载图像,但由于某种原因,图像没有显示在 AsyncImageView 中。此代码在更新之前运行良好,所以我不确定问题出在哪里:
AsyncImageLoader.sharedLoader().cancelLoadingURL(cell.rideImageView.imageURL)
cell.rideImageView.image = UIImage(named: "Unloaded")
cell.rideImageView.imageURL = NSURL(string: ride.rideImageSmall!)
我已经检查以确保图像 URL 从 Parse 正确加载,确实如此。这是我正在使用的库:https://github.com/nicklockwood/AsyncImageView
有人有什么想法吗?
由于 Apple 的新 "Apple Transport Security" 自 iOS9 (= Xcode7) 以来一直处于活动状态,您可能会遇到被阻止的网络请求。如果您想从 http:// URL 加载数据,您需要告诉应用程序,ATS 不适用于您的应用程序或某些域。
Apple 的技术说明在这里:https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/
首先,您可以将条目 NSAllowArbitraryLoads
= ON
的词典 NSAppTransportSecurity
添加到您的 Info.plist 中,然后查看您得到的程度:
如果 ATS 设置的某些名称不适合您,请阅读以下博客文章,其中描述了不同的名称 - 这些名称过去对我有用:http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/
我刚刚更新到 Xcode 7 和 Swift 2.0,当然它在我的应用程序中引起了一些问题。我已经解决了很多问题,但我正在为这个问题而苦苦挣扎。
在我的 table 视图中,我正在从 Parse.com 加载图像,但由于某种原因,图像没有显示在 AsyncImageView 中。此代码在更新之前运行良好,所以我不确定问题出在哪里:
AsyncImageLoader.sharedLoader().cancelLoadingURL(cell.rideImageView.imageURL)
cell.rideImageView.image = UIImage(named: "Unloaded")
cell.rideImageView.imageURL = NSURL(string: ride.rideImageSmall!)
我已经检查以确保图像 URL 从 Parse 正确加载,确实如此。这是我正在使用的库:https://github.com/nicklockwood/AsyncImageView
有人有什么想法吗?
由于 Apple 的新 "Apple Transport Security" 自 iOS9 (= Xcode7) 以来一直处于活动状态,您可能会遇到被阻止的网络请求。如果您想从 http:// URL 加载数据,您需要告诉应用程序,ATS 不适用于您的应用程序或某些域。
Apple 的技术说明在这里:https://developer.apple.com/library/prerelease/ios/technotes/App-Transport-Security-Technote/
首先,您可以将条目 NSAllowArbitraryLoads
= ON
的词典 NSAppTransportSecurity
添加到您的 Info.plist 中,然后查看您得到的程度:
如果 ATS 设置的某些名称不适合您,请阅读以下博客文章,其中描述了不同的名称 - 这些名称过去对我有用:http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/