2016-04-21 10:58:34.414 DailyFood[909:11798] _BSMachError: (os/kern) invalid capability (20)
2016-04-21 10:58:34.415 DailyFood[909:11798] _BSMachError: (os/kern) invalid name (15)
這兩行莫名的錯誤,google了半天,很多問題都會導(dǎo)致這個錯誤,例如Localization等,
但是我一行行的debug我的代碼的時候.
for image in self.sourceImages {
let imageData = UIImagePNGRepresentation(image)!
let fileName = token.stringByAppendingString("+\(now)\(i)")
let fileURL = userFolder.stringByAppendingString("/".stringByAppendingString(fileName))
if !(imageData.writeToFile(fileURL, atomically: true)) {
self.showAlertController("Alert", message: "Failed to save images.")
return
}
imagePathArray.append(fileName)
i += 1
}
問題好像出現(xiàn)在
let imageData = UIImagePNGRepresentation(image)!
這行, 因為我注釋掉這行就沒有問題了。但是網(wǎng)上也搜不到解決方案。不知道有沒有人遇到過這個問題的。
走同樣的路,發(fā)現(xiàn)不同的人生
The problem is that when I call self.view.endEditing(true)
來確保獲取用戶最新的輸入內(nèi)容。
并且segue
到其他的頁面或者是寫文件到disk才導(dǎo)致的問題
我用dispatch_async_()
來執(zhí)行self.view.endEditing(true)
, the error will no longer be reported. . It’s also quite depressing.