iphone - Terminated App due to memory Pressure -
i have app take images in burst mode ,but once when image take , come preview getting crashed , error shows "terminated app due memory pressure "
i need take more number of images when user holds camera button...after leave button ,i need show images slideshow..what have ?
my code is:
- (void)longpress:(uilongpressgesturerecognizer*)gesture { if (gesture.state == uigesturerecognizerstatebegan) { [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(takepictures) name:avcapturesessiondidstartrunningnotification object:nil]; } else if (gesture.state == uigesturerecognizerstateended) { } -(void)takepictures { [imagepicker takepicture]; }
help me..
storing images in ram costly, due high resolution of images. more, observer cause takepicture called multiple times - many. take multiple pictures using imagepicker, these images consume ram, , since ios has no swap - run out of ram. jetsam/memorystatus kicks in, , kills app, having consumed memory.
ways around this:
a) take less pictures in burst mode. use global variable , j, increment in takepictures, take actual picture on j % 2 == 0, or j %3 ==0 (you'll need play around value)
b) try save @ least of photos storage, release them ram (remove reference them).
Comments
Post a Comment