In my application i asked user to draw sign and then i show that image in UIImageView using below Code:
UIGraphicsBeginImageContext(captureView.bounds.size);
[captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
[ivStudentSign setImage:viewImage];
UIGraphicsEndImageContext();
NSMutableDictionary *tempDict=[[NSMutableDictionary alloc] init];
[tempDict setObject:UIImagePNGRepresentation(viewImage) forKey:userID];
[arrStoreSigns addObject:tempDict];
[userDef setObject:arrStoreSigns forKey:@"storeSigns"];
it almost works fine but sometime i get
setObjectForKey: object cannot be nil
that makes my application crash.What i'm doing wrong?I'm running application on ios 8.4.1