title: Error in dismissing a modal view controller
body: <p>I have encountered application termination while dismissing a modal view controller.</p>
  
  <pre><code>-[NSCFString window]: unrecognized selector sent to instance 0x6337dc0
  2011-06-03 13:26:37.980 Tuscany[19657:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString window]: unrecognized selector sent to instance 0x6337dc0'
  *** Call stack at first throw:
  (
      0   CoreFoundation                      0x016ffbe9 __exceptionPreprocess + 185
      1   libobjc.A.dylib                     0x018545c2 objc_exception_throw + 47
      2   CoreFoundation                      0x017016fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
      3   CoreFoundation                      0x01671366 ___forwarding___ + 966
      4   CoreFoundation                      0x01670f22 _CF_forwarding_prep_0 + 50
      5   UIKit                               0x003f4024 -[UIViewController viewControllerForRotation] + 81
      6   UIKit                               0x003ee8ab -[UIViewController shouldWindowUseOnePartInterfaceRotationAnimation:] + 34
      7   UIKit                               0x00368dd5 -[UIWindow _clientsForRotation] + 350
      8   UIKit                               0x0036b87b -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 141
      9   UIKit                               0x005eb948 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 1053
      10  UIKit                               0x003f7682 -[UIViewController _dismissModalViewControllerWithTransition:from:] + 2075
      11  UIKit                               0x003f4324 -[UIViewController dismissModalViewControllerWithTransition:] + 579
      12  Foundation                          0x000c37f6 __NSFireDelayedPerform + 441
      13  CoreFoundation                      0x016e0fe3 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19
      14  CoreFoundation                      0x016e2594 __CFRunLoopDoTimer + 1220
      15  CoreFoundation                      0x0163ecc9 __CFRunLoopRun + 1817
      16  CoreFoundation                      0x0163e240 CFRunLoopRunSpecific + 208
      17  CoreFoundation                      0x0163e161 CFRunLoopRunInMode + 97
      18  GraphicsServices                    0x01d88268 GSEventRunModal + 217
      19  GraphicsServices                    0x01d8832d GSEventRun + 115
      20  UIKit                               0x0035342e UIApplicationMain + 1160
      21  Tuscany                             0x00002878 main + 102
      22  Tuscany                             0x00002809 start + 53
  )
  terminate called after throwing an instance of 'NSException'
  </code></pre>
  
  <p>Above is the crash log. Please help.
  Thanks in advance.</p>