上传到 Parse 时 Imagepicker 崩溃

Posted

技术标签:

【中文标题】上传到 Parse 时 Imagepicker 崩溃【英文标题】:Imagepicker Crashing when Uploading to Parse 【发布时间】:2015-10-07 08:47:46 【问题描述】:

每当我尝试拍照以作为用户的个人资料图片上传到 Parse 时,我的应用程序就会不断崩溃。花了几个小时在网上寻找,但无法弄清楚。请帮忙

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) 
    let pickedImage: UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage
        let imageData = UIImagePNGRepresentation(pickedImage)
    let imageFile:PFFile = PFFile(data: imageData)
    PFUser.currentUser()!.setObject(imageFile, forKey: "profile_picture")
    PFUser.currentUser()!.saveInBackground()
    picker.dismissViewControllerAnimated(true, completion: nil)

【问题讨论】:

请将堆栈跟踪添加到您的问题中 【参考方案1】:

原来文件太大了,我需要对其进行缩放。感谢 Bjorn 提醒我查看堆栈跟踪

【讨论】:

以上是关于上传到 Parse 时 Imagepicker 崩溃的主要内容,如果未能解决你的问题,请参考以下文章