ios - Watchkit`s WKInterfaceImage setImage causes "Terminated due to Memory error" -
i want animate images on watch (like activity app, if you´re interested, it´s not important problem)
i draw images in loop first: glancecontroller.m
nsmutablearray *images = [[nsmutablearray alloc] init]; for(int = 0, j = 0; < 10; i++, j++){ @autoreleasepool { // ... uigraphicsbeginimagecontextwithoptions(rect.size, no, 0); // ... // create uiimage , save array later uiimage *ejcircle = uigraphicsgetimagefromcurrentimagecontext(); [images addobject: ejcircle]; ejcircle = nil; uigraphicsendimagecontext(); } }
so far works fine, autoreleaspool, memory consumption not high here, (about 5 mb before autoreleasepool gets drained 2 mb)
however try animate in wkinterfaceimage
, memory error:
// take array , create animated image out of uiimage * img = [uiimage animatedimagewithimages:images duration:1.0]; // memory normal 2 mb after line [wkinterfaceimage setimage:img]; // app crashes here // memory consumption jumps 30 mb after line: // watch app, app gets terminated. [wkinterfaceimage startanimatingwithimagesinrange:nsmakerange(0,50) duration: 1.0 repeatcount: 1];
my question is, why app crashes in line. memory consumption explodes, don´t alloc/malloc/new
here. don't understand what´s going on, appreciated.
edit: found crash log in xcode devices:
jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: identifier: myapp watchkit extension jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: version: ??? jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: code type: arm-64 (native) jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: parent process: debugserver [620] jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: date/time: 2015-07-14 16:04:04.134 +0200 jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: launch time: 2015-07-14 16:03:42.401 +0200 jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: os version: ios 8.4 (12h143) jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: report version: 105 jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: exception type: exc_resource jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: exception subtype: memory jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: exception message: (limit 30 mb) crossed high water mark jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: triggered thread: 0 jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: thread 0 name: dispatch queue: com.apple.main-thread jul 14 16:04:04 iphone-6-plus reportcrash[622] <error>: thread 0 attributed:
Comments
Post a Comment