Clear texture crash

I was meeting a problem when I try to clear the texture content use the method:
attention: the autoResizeDrawable is true

CGSize blankSize = CGSizeMake(self.bounds.size.width, self.bounds.size.height);
self.region = MTLRegionMake2D(0, 0, blankSize.width, blankSize.height);
self.blankData = calloc(1, blankSize.width * blankSize.height * 4);
self.bytesPerRow = 4 * blankSize.width;
[nextDrawable.texture replaceRegion:self.region mipmapLevel:0 withBytes:self.blankData bytesPerRow:self.bytesPerRow];

except iOS12, the code work very well, but in iPhone 8 Plus iOS12, when enter the next draw iteration, the size was auto changed but the self.region not changed, so it’s crashed.
Is there any solution to handle this problem?

After I update the macOS and Xcode, the problem seems disappear and it’s work well on the iPhone now

Thanks for updating your post - I’m glad you got it working :smiley: