ios - MKMapSnapshotter WatchKit memory error -
i have major issues mksnapshotter when testing 'watch application' / ios app watch extension on real iphone connected apple watch!
inside 1 of interface controllers call following function:
func createmapsnapshot(){ //snapshotter overview image self.options = mkmapsnapshotoptions() self.options!.region = getendregion() self.snapshotter = mkmapsnapshotter(options: options!) snapshotter!.startwithcompletionhandler() {snapshot, error in dispatch_async(dispatch_get_main_queue()) { var finalimage = self.drawendrun(snapshot.image, snapshot: snapshot) self.mapimage.setimage(finalimage) } } }
this should create image of map , fill wkinterfaceimage it. create image memory jumps 3 mb 20 mb , stays there if set options = nil , snapshotter = nil. following message printed on console:
watchkit extension[9548:2529231] bsxpcmessage received error message: connection interrupted
but here comes worst part: want create snapshot watch app crashes due memory error! assume happens because snapshotter won't free memory after allocating it... how can manually or have idea?
it has nothing getendregion() function! tested default snapshotter without options -> same result!
if test app in simulator works fine!
update:
i searched documentation of mkmapsnapshotter , says, can deliver snapshot if app in foreground, can't rendered main application , memory allocated ios watch extension low, there other way??
the simulator has access lot more memory available extension running on phone. i'd suggest kicking off request iphone app using openparentapplication:reply:
, doing work there.
secondary question: why generate image of map yourself? wkinterfacemap
doing on watch you.
Comments
Post a Comment