diff -Naru a/src/plugins/platforms/ios/ios-log.h b/src/plugins/platforms/ios/ios-log.h --- a/src/plugins/platforms/ios/ios-log.h 1970-01-01 02:00:00.000000000 +0200 +++ b/src/plugins/platforms/ios/ios-log.h 2014-11-16 17:43:25.000000000 +0200 @@ -0,0 +1,9 @@ +#import + +// Use as: +//[LogFile WriteLogWithString:@"some string"]; + +@interface iOSLogFile : NSObject ++ (void)WriteLogWithString:(NSString *)log; + +@end diff -Naru a/src/plugins/platforms/ios/ios-log.mm b/src/plugins/platforms/ios/ios-log.mm --- a/src/plugins/platforms/ios/ios-log.mm 1970-01-01 02:00:00.000000000 +0200 +++ b/src/plugins/platforms/ios/ios-log.mm 2014-11-16 17:43:38.000000000 +0200 @@ -0,0 +1,42 @@ +#include "ios-log.h" + +@implementation iOSLogFile + + ++ (NSString*)CurrentSystemTime { + return [[NSDate date] description]; +} + ++(NSString*)getDocumentsPath +{ + NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; + return path; +} + ++ (NSString*)getLogFilePath +{ + NSString *loggingFilePath = nil; + + loggingFilePath = [[self getDocumentsPath] stringByAppendingPathComponent:@"/DebugLogFile.txt"]; + return loggingFilePath; +} + + ++ (void)WriteLogWithString:(NSString *)log +{ + + if(log != nil){ + + NSString *locationFilePath = [self getLogFilePath]; + + NSString *str = [NSString stringWithFormat:@"%@ %s [Line %d]: %@", [self CurrentSystemTime],__PRETTY_FUNCTION__,__LINE__,log]; + FILE *fp = fopen([locationFilePath UTF8String], "a"); + + fprintf(fp,"%s\n", [str UTF8String]); + + fclose(fp); + } + +} + +@end diff -Naru a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm --- a/src/plugins/platforms/ios/qiosinputcontext.mm 2014-11-09 22:38:35.000000000 +0200 +++ b/src/plugins/platforms/ios/qiosinputcontext.mm 2014-11-16 17:40:34.000000000 +0200 @@ -48,6 +48,7 @@ #include "qiostextresponder.h" #include "qioswindow.h" #include "quiview.h" +#include "ios-log.h" #include #include @@ -88,14 +89,22 @@ m_curve = UIViewAnimationCurveEaseOut; m_viewController = 0; + [iOSLogFile WriteLogWithString:@"initWithQIOSInputContext - before isQtApplication"]; + if (isQtApplication()) { // Get the root view controller that is on the same screen as the keyboard: for (UIWindow *uiWindow in [[UIApplication sharedApplication] windows]) { + NSString* logStr1 = [NSString stringWithFormat:@"%@ %p %@ %d", @"found window: ", uiWindow, @", is mainScreen:", (bool)(uiWindow.screen == [UIScreen mainScreen])]; + [iOSLogFile WriteLogWithString:(NSString *)logStr1]; + if (uiWindow.screen == [UIScreen mainScreen]) { m_viewController = [uiWindow.rootViewController retain]; + NSString* logStr2 = [NSString stringWithFormat:@"%@ %p", @"found view controller:", m_viewController]; + [iOSLogFile WriteLogWithString:(NSString *)logStr2]; break; } } + [iOSLogFile WriteLogWithString:@"initWithQIOSInputContext - after looping UIWindow"]; Q_ASSERT(m_viewController); // Attach 'hide keyboard' gesture to the window, but keep it disabled when the @@ -106,6 +115,9 @@ self.delaysTouchesEnded = NO; [m_viewController.view.window addGestureRecognizer:self]; } + else { + [iOSLogFile WriteLogWithString:@"initWithQIOSInputContext - for non Qt Application"]; + } [[NSNotificationCenter defaultCenter] addObserver:self @@ -120,6 +132,9 @@ selector:@selector(keyboardDidChangeFrame:) name:@"UIKeyboardDidChangeFrameNotification" object:nil]; } + else { + [iOSLogFile WriteLogWithString:@"initWithQIOSInputContext - self is nil"]; + } return self; } diff -Naru a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm --- a/src/plugins/platforms/ios/qiosscreen.mm 2014-11-09 22:38:35.000000000 +0200 +++ b/src/plugins/platforms/ios/qiosscreen.mm 2014-11-16 17:40:34.000000000 +0200 @@ -43,6 +43,7 @@ #include "qiosintegration.h" #include "qiosscreen.h" #include "qioswindow.h" +#include "ios-log.h" #include #include "qiosapplicationdelegate.h" #include "qiosviewcontroller.h" @@ -184,6 +185,7 @@ , m_uiWindow(0) , m_orientationListener(0) { + [iOSLogFile WriteLogWithString:@"QIOSScreen::QIOSScreen - entered"]; if (screen == [UIScreen mainScreen]) { QString deviceIdentifier = deviceModelIdentifier(); @@ -204,6 +206,11 @@ // External display, hard to say m_depth = 24; m_unscaledDpi = 96; + [iOSLogFile WriteLogWithString:@"QIOSScreen::QIOSScreen - non-mainScreen"]; + + if (screen == nil) { + [iOSLogFile WriteLogWithString:@"QIOSScreen::QIOSScreen - screen is nil"]; + } } for (UIWindow *existingWindow in [[UIApplication sharedApplication] windows]) { @@ -218,12 +225,23 @@ m_uiWindow = [[UIWindow alloc] initWithFrame:[m_uiScreen bounds]]; m_uiWindow.rootViewController = [[[QIOSViewController alloc] initWithQIOSScreen:this] autorelease]; + NSString* logStr1 = [NSString stringWithFormat:@"%@ %p %@ %d", @"created window: ", m_uiWindow, @", is mainScreen:", (bool)(m_uiWindow.screen == [UIScreen mainScreen])]; + [iOSLogFile WriteLogWithString:(NSString *)logStr1]; + + if (m_uiWindow) { + NSString* logStr2 = [NSString stringWithFormat:@"%@ %p", @"created view controller:", m_uiWindow.rootViewController]; + [iOSLogFile WriteLogWithString:(NSString *)logStr2]; + } + // FIXME: Only do once windows are added to the screen, and for any screen if (screen == [UIScreen mainScreen]) { m_uiWindow.screen = m_uiScreen; m_uiWindow.hidden = NO; } } + else { + [iOSLogFile WriteLogWithString:@"QIOSScreen::QIOSScreen - m_uiWindow is nil"]; + } updateProperties(); }