var image = self.imageData[index] as NSString
if let derp = image as NSString? {
println(" \(image)")
} else {
println("is nil")
}
dataViewController.dataImage.image = UIImage(named: image) as UIImage
最後一行:如何避免在這種情況下的Optional.None錯誤?
dataViewController.dataImage.image = UIImage(named: image) as UIImage
給我「不能拆開包裝Optional.None」,儘管圖像對象成功通過可選的結合試驗如下所示https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-XID_428。圖像字符串確實打印在Xcode的底部。
的可能重複【如何正確檢查,如果無可選的返回值是否有效?(http://stackoverflow.com/questions/24439773/how-to-properly-check-if-non-optional-return-值是有效的) –