I just updated:
xcodeVersion 6.3 (6D570)
Swift 1.2 has messed up my word last night and apparently they have made some changes in either Swift or Parse.
I am confused I just don't know how to fix this issue... Need help please. If someone else has experienced the same and has fixed it, please help me.
import UIKit
import Parse
class ProfileViewController: UIViewController, UITextFieldDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate {
// MARK: Variables declaration
@IBOutlet weak var uploadPhotoBtn: UIButton!
@IBOutlet weak var profilePhotoImageView: UIImageView!
@IBOutlet var welcomeMessageLabel: UIView!
@IBOutlet weak var greetings: UILabel!
var imagePicker = UIImagePickerController()
var existingImage : UIImage?
var user = PFUser.currentUser()
// The view has loaded this is the function that will be run at first before anything else
override func viewDidLoad() {
super.viewDidLoad()
// MARK: make a circle image
profilePhotoImageView.layer.cornerRadius = profilePhotoImageView.frame.size.width/2
profilePhotoImageView.clipsToBounds = true
//show my status
var mood = self.user["status"] as! String //=> 'AnyObject' is not convertible to 'String'
self.greetings.text? = ( "\(mood)" )
//get image if existing
self.user[ "avatar" ] as? PFFile //=> 'PFFile? is not convertible to 'StringLiteralConvertible'
if let userImageFile = self.user["avatar"] as? PFFile {PFFile? is not convertible to 'StringLiteralConvertible'
userImageFile.getDataInBackgroundWithBlock({ (imageData:NSData!, error: NSError!) -> Void in
if error == nil {
self.existingImage = UIImage(data: imageData)
self.profilePhotoImageView.image = self.existingImage
}else {
let alert = UIAlertView(title: "Oops!", message: "Unable to get your profile photo", delegate: self, cancelButtonTitle: "Ok!")
alert.show()
}
})
}