When I toggle on the install via USB in developer mode:
Faced same problem with Xiaomi Mi5 MUI9.
Turning on/off connections or MUI optimization did not work for me. What worked is:
Settings -> Additional Settings -> Privacy -> enable Unknown sources
In my case,I was using my phone that is Redmi 4 and the usb debugging was not working.It was always giving the message "the device is temporarily restricted" .I have tried all this steps but the result was same.Then I found the foolish thing that I have put the device in charging mode only.When I switch to MTP(Transfer files) and then it started working correctly.I know its a foolish thing but it may help to someone.
In MIUI 8.5 it gives the error like you mention while enabling "install via USB", to resolve the error you need to make WIFI off and make mobile data on and then enable the option “Install via USB”. it will work for you.
A detailed blog: http://sforsuresh.in/xiaomi-mi-note-4-install-via-usb-device-temporarily-restricted/
Above solutions doesn't work for me. In my case it works by changing Additional settings -> Region to Russia/Some other country.
Solution with NO VPNing that worked for me:
Settings->Accounts->MiAccount->AccountSecurity->Devices
I assume not everyone will have a Redmi device listed there, maybe some will have a different device, maybe some will even have the correct device(this is not something I can test by myself), but it makes sense to me that correcting any wrong devices from that list (or maybe deleting all devices like I did) might fix the problem.
Disable WiFi and switch install via USB on while you are connected through data and under your xiaomi account. It works!