数据未转换为String

时间:2018-01-11 13:15:54

标签: ios swift

我正在尝试将图像转换为数据,然后使用此代码将该数据转换为字符串,但是当我想将数据转换为字符串时,转换失败

let data = UIImagePNGRepresentation(selectedImageImageView.image!)
let datastring = String(data: data!, encoding: .utf8)

它提供了一些数据,但在数据字符串中始终为nil 无法弄清楚问题出在哪里,如果有人知道请帮助...谢谢

1 个答案:

答案 0 :(得分:1)

$(document).keydown(function(e) {
     ...
     CheckPosition();
});