2

私はちょうど更新しました:

xcodeバージョン 6.3 (6D570)

Swift 1.2 は昨夜の私の言葉を台無しにしてしまい、どうやら Swift または Parse のいずれかにいくつかの変更を加えたようです。

この問題を解決する方法がわかりません...助けが必要です。他の誰かが同じことを経験し、それを修正した場合は、私を助けてください。

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()

                }
            })
        }
4

2 に答える 2