I create a file management application and sometimes get the following error when calling UIImagePickerController
or MPMediaPickerController
:
*** -[_UIImageViewPretiledImageCacheKey hash]: message sent to deallocated instance 0x140dc0
I recently gave my application a custom theme using the IOS 5 UIAppearance API, and when I started getting this error. Guessing and checking, I found problematic lines of my code that cause this error:
UIImage *backButtonImage = [[UIImage imageNamed:@"backButton.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(12, 16, 12, 8)]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; UIImage *barButtonImage = [[UIImage imageNamed:@"barButton.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(14, 12, 14, 12)]; [[UIBarButtonItem appearance] setBackgroundImage:barButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
I do not know how this code causes the above error. Could you explain to me the source of this error and provide a solution to resolve it.
Thanks in advance for your help, Guvvy
source share