Can not get my iMac Keyboard to Pair
I have had problems with this awful keyboard ever since I bought this iMac in 2015. It works for a while then cuts off. I change the batteries, then it works, but only for a short time. I just got tired of it so I purchased a Logitech solar keyboard because I thought the issue was with the batteries draining. But now I just want the thing to work before it is no longer under warranty. Please advise. Thanks in advance.
iMac (Retina 5K, 27-Inch, Mid 2015), iOS 11