2016-11-23 6 views
2

코어 데이터를 삭제하고 객체화하려고 시도하고 아래에서 try catch 내에서 시도했습니다.''try '표현식에서'throw '표현식 내에 [throw] 표현식이 발생하지 않습니다. 3

do { 
    try self.managedContext.deleteObject(self.productList[indexPath.row]) 
} catch let error as NSError { 
     print("something wrong with the delete : \(error.userInfo)") 
} 

'no calls to throwing functions occur within 'try' expression'catch block is unreachable because no errors are throw in 'do' block을 말한다. 다음 이미지는 더 많은 아이디어를 제공합니다.

enter image description here

는 이유입니다. 나는 모른다. 이 문제를 해결하는 방법. 당신의 도움을 바랍니다.

+4

오류 메시지는 문자 그대로 당신이 알아야 할 모든 것을 알려줍니다 ... – Alexander

답변

6

deleteObject 메서드는 throw하지 않습니다. Do-Catch 블록을 제거하면 경고 메시지가 사라집니다. 경고는 꽤 자명 한 것처럼 보입니다.