David U David U - 1 year ago 105
iOS Question

Crash in PPSSignatureView

I’m using Xcode 6 to develop an app for iOS 7. I’m having an issue with the

component downloaded from GitHub. I’m presenting the signature view in a popover. The first time the signature view displays it works and everything is fine. But when I redisplay the same popover a 2nd time, I get an error in

#import <OpenGLES/ES2/glext.h>

// Append vertex to array buffer
static inline void addVertex(uint *length, PPSSignaturePoint v) {
if ((*length) >= maxLength) {

memcpy(data + sizeof(PPSSignaturePoint) * (*length), &v, sizeof(PPSSignaturePoint));


On the 2nd presentation,
generates the error

Thread 1:EXC_BAD_ACCESS(code=1, address=0x0)

I do not know the OpenGL library. I have read some SO entries about OpenGL, Xcode 6 and iOS8, but those issues refer to compile time errors and I am having a run time error. Does anyone understand what is going on?


Edit: I know the error looks like a low-memory error. I'm not getting a memory warning from iOS and I'm having trouble believing that's the real problem. Also, on the second and subsequent presentations, if I do a long press on the signature view before I start drawing then the signature view does not crash. But calling the long press action in code on the second presentation does not prevent the crash.

Here's the long press code:

- (void)longPress:(UILongPressGestureRecognizer *)lp {
[self erase];

- (void)erase {
length = 0;
dotsLength = 0;
self.hasSignature = NO;

[self setNeedsDisplay];

Answer Source

Thanks for your reply. I fixed the error by adding the call

[signatureView erase]

immediately after presenting the popover containing the signature view.