Error de "contexto no válido 0x0" al utilizar las funciones CGContext *

/*  Adding the Path */
UserGraphBuff = UIGraphicsGetCurrentContext();

CGContextSetRGBStrokeColor(UserGraphBuff,5,10,0,1);
CGContextSetLineWidth(UserGraphBuff, 2 );

CGContextBeginPath(UserGraphBuff);  

//line to last user point
CGContextAddLineToPoint(UserGraphBuff, (*xVal)[sizeof xVal / sizeof *xVal - 1], (*yNewVal)[sizeof yNewVal / sizeof *yNewVal - 1]);
//line to rest of user points in reverse order
for (int i = sizeof xVal / sizeof *xVal - 1; i > -1; i--){
    CGContextAddLineToPoint(UserGraphBuff, (*xVal)[i], (*yNewVal)[i]);
}

//EOFill
CGContextEOFillPath(UserGraphBuff);

Above es el código con el que estoy tratando de trabajar. Se supone que debe hacer lo que CGContext dice que hace, pero no estoy sacando nada. @Sigo recibiendo este error

Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextSetRGBStrokeColor: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextSetLineWidth: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextBeginPath: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextAddLineToPoint: invalid context 0x0
Fri Oct 28 13:18:40 case.app testApplication[4127] <Error>: CGContextDrawPath: invalid context 0x0

Refiero el CGContextRef en mi archivo de encabezado.

No creo que entienda bien CGContext ni sé qué debería ser CGContextRef.

Respuestas a la pregunta(1)

Su respuesta a la pregunta