我有这个代码,我认为这是问题:
CGContextRef context = CGBitmapContextCreate(nil,
routeView.frame.size.width,
routeView.frame.size.height,
8,
4 * routeView.frame.size.width,
CGColorSpaceCreateDeviceRGB(),
kCGImageAlphaPremultipliedLast);
CGContextSetStrokeColorWithColor(context, lineColor.CGColor);
CGContextSetRGBFillColor(context, 0.0, 0.0, 1.0, 1.0);
CGContextSetLineWidth(context, 1.0);
来自:https://github.com/kadirpekel/MapWithRoutes/tree/master/Classes
这实际上正在使用任何更改的项目,然后我尝试将某些东西导入我的代码并且不起作用,我收到此错误:
Feb 5 14:16:17 alejandro.upes.itccanarias.org GPSTestMap[2878] <Error>: CGContextSetStrokeColorWithColor: invalid context 0x0
Feb 5 14:16:17 alejandro.upes.itccanarias.org GPSTestMap[2878] <Error>: CGContextSetRGBFillColor: invalid context 0x0
Feb 5 14:16:17 alejandro.upes.itccanarias.org GPSTestMap[2878] <Error>: CGContextSetLineWidth: invalid context 0x0
Feb 5 14:16:17 alejandro.upes.itccanarias.org GPSTestMap[2878] <Error>: CGContextDrawPath: invalid context 0x0
Feb 5 14:16:17 alejandro.upes.itccanarias.org GPSTestMap[2878] <Error>: CGBitmapContextCreateImage: invalid context 0x0
答案 0 :(得分:0)
答案是@Sohaib评论:
Make sure your routeView is initialized properly and CGBitmapContextCreate function doesn't return nil
– Sohaib 13年2月5日,14:32