Home>

I'm making an app that imitates Twitter with Xcode.

Clyde uses Nifty Cloud.

Error message

The photo is not reflected on the icon on the timeline post screen.

source code:

Swift

Source code

// Calling a registered cell
let cell = tableView.dequeueReusableCell (withIdentifier: "Cell") as! RoomTableViewCell

From the collection of data called // posts, data such as text and userName are brought in order from the top
//? == "nil is allowed"
cell.contentLabel? .text = posts [indexPath.row] .text

let user = posts [indexPath.row] .user

cell.userNameLabel.text = user.displayName

let userImageUrl = "https://mbaas.api.nifcloud.com/2013-09-01/applications/HlgrPhqq9ECHzZT3/publicFiles/VKD52cVhRFPhLmTY.png"

// Round the photo
cell.userImageView.layer.cornerRadius = cell.userImageView.bounds.width/2.0
cell.userImageView.layer.masksToBounds = true

// Displaying the number of likes
cell.likeCountLabel.text = String (posts [indexPath.row] .likeCount)

cell.tag = indexPath.row
if let userImageUrl = posts [indexPath.row] .user.imageUrl {
// Acquire images with kf
cell.userImageView.kf.setImage (with: URL (string: userImageUrl), placeholder: nil, options: nil, progressBlock: nil) {(image, error, cache, url) in
if let error = error {
// Display "unknown error happened"
print (error.localizedDescription)
}
// Paste photo after successful acquisition
if let image = image {
cell.userImageView.image = image

}

}
}

  • Answer # 1

      

    if let userImageUrl = posts [indexPath.row] .user.imageUrl {

    Is the URL correct in this line?
    In short, I think that processing has not been performed up to the line "// Get image with kf".