Reputation: 591
I'm writing an iOS application and integrated FDWaveformView 2.0.0 via CocoaPods. Sometimes UIGraphicsGetCurrentContext() returns nil and I get the "FDWaveformView failed to get graphics context" log message.
guard let context = UIGraphicsGetCurrentContext() else {
NSLog("FDWaveformView failed to get graphics context")
return
}
Does anyone know how to solve this issue?
Upvotes: 0
Views: 4129
Reputation: 223
Ensure that You are calling UIGraphicsGetCurrentContext() inside draw(_ rect : CGRect)() method.
Also ensure that you are not manually calling draw(_ rect : CGRect). Instead call setNeedsDisplay() which will call draw(_ rect : CGRect).
Upvotes: 3