I've been occasionally seeing the error message:
CGAffineTransformInvert: singular matrix
In the logging area of Xcode. This seems to occur (infrequently, fortunately) when I pinch to resize a web site within a UIWebView. [Commercial website, not my own.] Since I do no Affine Transformations in my App, I'm wondering if this might be a bug/feature of UIWebView. If so, can I ignore it, since it doesn't seem to be interfering with anything?
From looking around at other posts, it appears you'll get this message if you try and set the zoom scale to zero. Would be useful to NSLog the scale value when you pinch and see if it gets to zero (and occurs at the same time as the affine transform error).
Try using a real near zero value then :
#define kNearZeroValue 0.001f
This is the problem with affine transformations when transforming matrix somewhere in the code.
So basically the code is trying to transform a singular matrix (determinant is 0) which is invalid. So you should avoid matrices like:
0 0 0
0 0 0
0 0 1
and similar by checking whether it's singular 3x3 matrix based on its determinant. It is considered a mathematical violation to perform operations on matrices with a determinant of zero (similar to dividing by zero).
If you're using uiscrollview class, make sure you aren't scaling instance to 0 either using setZoomScale:animated:
method or zoomScale
property, so please check your scroll views (set your zoomScale
, minimumZoomScale
and maximumZoomScale
to set to at least 0.1).
Source: CGAffineTransformInvert - singular matrix error
For each webView do:
webView.scrollView.minimumZoomScale = 0.1;
Or any other number greater than zero.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With