Unfortunately you have provided very little information. Assuming all of your settings are correct the only thing left to do is:
- Restart the iPhone
- Restart the iMac in Safe Mode ensuring the keyboard's charging cable is plugged into the keyboard and the back of the iMac. When restarting please continue holding down the Shift key until the computer restarts which can take up to 10 minutes. Then restart normally and test.
If you still have no luck please either call AppleCare ( AppleCare Contact Info ) or book an appointment at your local Apple Authorized Service Provider. You can begin the appointment booking step by clicking the Support link in the upper right of this web page.
If you have ANY of the following types of third party apps installed that is VERY likely the cause of any problems you are experiencing:
- Antivirus apps
- Cleaning apps
- Security apps
- VPN apps
- Maintenance apps