This error is when you display a picture with Uiimageview. UIImage is the Imagenamed method. The reason for the error is that too many files are open. It should be too many files open causing the UIImage cache to be deleted so that the cached picture cannot be retrieved. Looking for a long time did not find the problem, because imagenamed this method will cache the picture, that is, no matter how many Uiimageview use this image will not cause additional picture overhead.
Later, after a test, it dawned. The problem doesn't come from UIImage. The original thought is that the program loaded too many pictures caused this error, but the test found that as long as not using too many different pictures is no problem. The real killer is actually the audio player in my program. The player in my program constantly plays the sound effects, causing too many files to be opened, which has never caused the UIImage cache to be recycled.
The optimization of the player is very simple, in fact, is not to use Avaudioplayer, but to use audioservices.
iOS error-Too many open files (Error = 24)