I have an application compiled for iOS8. The app is set to allow portrait orientation only in the project settings. The views of the application do not rotate to landscape by design. In iOS7 when you rotate the device to landscape the keyboard is not rotated. This is the behaviour I desire.
However, in iOS8 when you rotate the device to landscape the keyboard will incorrectly switch to landscape orientation.
I have tested this on a physical iPhone 6 Plus to confirm the issue. Also tested it on iPhone 5 via simulator. Any idea how to fix this issue?
POTENTIAL FIX
I don't remember exactly why I was doing it but I have some bootstrapping code that executes when the app starts:
d.window.rootViewController = tabBarController;
Where tabBarController is the top level tab bar controller for the app. Removing this bootstrapping code fixes the issue.
SUGGESTED DEBUGGING
Whilst this did not appear in previous versions of iOS it looks like iOS8 behaves a bit differently. I would recommend checking any bootstrapping code you have. You may have to try a sample project and add some bits until you find the culprit as it was quite hard to track down in my case. The two answers provided below are kind of fixing the symptoms not the cause so I have not marked them as correct.
I was facing the same problem mentioned by Carles Estevadeordal on iOS 8 device for the application developed for iOS 7.
After little investigation I found that application was calling following method of UIViewController,
"+ (void)attemptRotationToDeviceOrientation"
Description of this method given in UI framework is, “if the current interface orientation does not match the current device orientation, a rotation may occur”
Simply commenting this method call,the issue got resolved.
My problem similar to the question, I tied Emmo213 solution but the error seems to go randomly off and on, so this does not work, the problem in my case seems only to affect the iPhone 6 Plus. I decided to let the response since it may help somebody, if I find one i will edit the response.
Edit: Found a solution, the problem definitely does not happen when the App is not working in scaled mode: How do I create launch images for iPhone 6 / 6 Plus Landscape Only Apps?
Edit: This is definitely not a solution since the problem goes on and off randomly.
I tried Emmo213 solution to the problem and it kind of fixed the problem for me, yet afterwards I deleted this part of code and could not reproduce the problem again...
I hope it may help somebody, but since it looks like a rare buggy behaviour difficult to reproduce I cannot assure this is a valid solution...
It is is not a bug of iOS8 or iPhone 6. It is problem of the correct migration of old projects to xCode6.
You simply need to add Launch screen interface file base name key to Info.plist file.
Detailed explanation of this case you can find here.
I have a similar problem and have found that pre iOS8 the keyboard orientation is tied to the orientation of the status bar but unfortunately in iOS8 the keyboard and status bar orientation are separate. While it doesn't help solve your problem hopefully this provides a little bit of information as to why it's happening.
Edit: Try the following code - it worked for me. Based on which orientations are allowed you'll have to change which way you're flipping the device obviously.
It is basically the Bug in Xcode 6, to avoid this you may build your project using Xcode 5 or Using Xcode 7. I tried on xcode5 and xcode7-beta and on both versions the keyboard problem was not there. But when i build using xcode 6 then the problem appears , so try to build your project using Xcode 5 or Xcode7 (Soon stable version of Xcode7 will available.). Hope this will help.