Most probable cause is that Metal buffers or shaders are overloaded
there is a limitations of using metal technology and it is described here
https://developer.apple.com/library/content/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/BestPracticesforShaders/BestPracticesforShaders.html
I was having this problem before and i was about to switch from Metal to OpenGL But the advantages of Metal let me try again then i discover that my issue that i was Calculating and sorting an Array of Heavy data (Mostly floats and doubles) within the renderer function
My Mistake was Here See the remarked line
- (void)renderer:(id <SCNSceneRenderer>)renderer updateAtTime:(NSTimeInterval)time
{
[self calculateMyData]; // This Is Wrong
}
- (void)calculateMyData
{
// the Heavy Calculations
}
to avoid most IOAF Errors try not to do heavy or complex calculations like sorting data or such within the renderer try use External Loops to call this calculations. This is what i have done
- (void)viewDidLoad
{
// I Use A Timer Loop Every 0.3 Sec to call the heave calculations and sort data
NSTimer *timerCounter2 = [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(calculateMyData) userInfo:nil repeats: YES];
}
- (void)renderer:(id <SCNSceneRenderer>)renderer updateAtTime:(NSTimeInterval)time
{
//[self calculateMyData]; // Now I Avoid The Mistake
}
- (void)calculateMyData
{
// the Heavy Calculations
}