Trouble with querySpriteInfoAlongLine?

i'm making a basic pong clone, and i'm trying to make a basic ai for the enemy paddle. to do this i need a function that predicts where the ball will land on the right side whenever the ball changes direction. right now, my implementation is a recursive call to querySpriteInfoAlongLine (i would use querySpritesAlongLine, but as you could guess i specifically need the entry point)that does a raycast every time the ball hits a floor or ceiling until it hits the wall.

this works fine in the simulator, but crashes on the device; my best guess is that this recursive function is taking more than 10 sec. has anyone else run into this issue before, and is there a cheaper alternative i could use?

only solution is to adapt your code in such a way that whatever you are calucalating can be calculated over multiple frames instead of 1 frame so you don't hit the 10 second limit per frame

How many times is the function being called in those 10 seconds? Why does it need to be recursive?

Should it not be called only once after init or every ball collision?