Reputation: 416
The problem appeared on iOS 6. To reproduce it you need to enter text with japanese (kana) keyboard and press on 'Lock' button when suggestions appear. After unlocking user is on application dashboard instead of the application. If press on application icon it's loaded again - app crashed when lock was pressed. It's true even for apple apps like Notes
Crash logs:
Application Specific Information:
YOUR_APP was suspended with locked system files:
/private/var/mobile/Library/Keyboard/PhraseLearning_ja_JP.db/sqlite.db
/private/var/mobile/Library/Keyboard/BigramLearning_ja_JP.db/sqlite.db
It seems iOS tries to save user's choices in db to make suggestions more intellectual but it writes to db when it cannot write.
I've posted bug to Apple already but nobody know when they fix it
You can's just say to people using your application that it is Apple's problem - you need to solve it. I tried hide keyboard on applicationWillResignActive and show it when app loads but it didn't help a lot. Any suggestions?
UPDATE. I was hoping they will fix it in 6.0.1 but unfortunately NO :-(
Upvotes: 3
Views: 3157
Reputation: 1590
Expanding on the other answer and its comments, I found that this worked for me. It has the advantage that you don't need to know which text field was active:
if ([[[UIDevice currentDevice] systemVersion] compare:@"6.0" options:NSNumericSearch] != NSOrderedAscending) {
if (backgroundTask != UIBackgroundTaskInvalid)
[application endBackgroundTask:backgroundTask];
backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{
[application endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
}];
}
Upvotes: 0
Reputation: 10593
Using 'Task Completion' to delay enter background.
Hide keyboard during additional time (10 minutes).
It is workaround.
Example:
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Acquired additional time
UIDevice *device = [UIDevice currentDevice];
BOOL backgroundSupported = NO;
if ([device respondsToSelector:@selector(isMultitaskingSupported)]) {
backgroundSupported = device.multitaskingSupported;
}
if (backgroundSupported) {
backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{
[application endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
}];
}
// Hide keyboard
[self.textField resignFirstResponder];
}
Upvotes: 2