Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?

I get this warning only on my first item on a table view once i go into the "drill down" view on a core data app.

anyone else got this warning?

-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?

thanks

like image 984
George Asda Avatar asked Sep 02 '14 10:09

George Asda


1 Answers

Xcode 7.2.1, iOS 9.2.1, ARC enabled

Check to see that the NSData object you are using to store data does not get released before it is accessed. You must check this at the place where the data is accessed, not in your view controller or else where.

-[NSKeyedUnarchiver initForReadingWithData:]: data is empty; did you forget to send -finishEncoding to the NSKeyedArchiver?

This warning is raised when the NSData object is empty. The sure way to check if it is or not, is to use [yourDataObject length] and make sure it is not zero.

Hope this helps! Cheers.

like image 52
serge-k Avatar answered Nov 01 '22 01:11

serge-k