You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/06/01 02:00:38 UTC
ios commit: Fixes CB-328 - Cordova crashes on iOS 3.x devices
Updated Branches:
refs/heads/master 4f48fb0f2 -> 982d0bb3f
Fixes CB-328 - Cordova crashes on iOS 3.x devices
Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/982d0bb3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/982d0bb3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/982d0bb3
Branch: refs/heads/master
Commit: 982d0bb3f48701b57bea323962355a209c4da705
Parents: 4f48fb0
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu May 31 17:00:30 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu May 31 17:00:30 2012 -0700
----------------------------------------------------------------------
CordovaLib/Classes/CDVLocalStorage.m | 4 +++-
CordovaLib/Classes/CDVViewController.m | 12 ++++++++----
2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/982d0bb3/CordovaLib/Classes/CDVLocalStorage.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocalStorage.m b/CordovaLib/Classes/CDVLocalStorage.m
index 05ab034..10fd877 100644
--- a/CordovaLib/Classes/CDVLocalStorage.m
+++ b/CordovaLib/Classes/CDVLocalStorage.m
@@ -293,7 +293,9 @@
- (void) onResignActive
{
- if ([[UIDevice currentDevice] isMultitaskingSupported])
+ UIDevice* device = [UIDevice currentDevice];
+
+ if ([device respondsToSelector:@selector(isMultitaskingSupported)] && [device isMultitaskingSupported])
{
__block UIBackgroundTaskIdentifier backgroundTaskID = UIBackgroundTaskInvalid;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/982d0bb3/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index f3cfe01..7e318ec 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -58,12 +58,16 @@
name:UIApplicationWillTerminateNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillResignActive:)
name:UIApplicationWillResignActiveNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:)
- name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:)
- name:UIApplicationDidEnterBackgroundNotification object:nil];
+
+ if (IsAtLeastiOSVersion(@"4.0"))
+ {
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppWillEnterForeground:)
+ name:UIApplicationWillEnterForegroundNotification object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppDidEnterBackground:)
+ name:UIApplicationDidEnterBackgroundNotification object:nil];
+ }
self.commandDelegate = self;
self.wwwFolderName = @"www";