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/01/17 02:00:22 UTC

[2/2] git commit: Fixed runtime error (missing selector) for PGURLProtocol - for pre-1.4 generated projects.

Fixed runtime error (missing selector) for PGURLProtocol - for pre-1.4 generated projects.


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/5b37b554
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/5b37b554
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/5b37b554

Branch: refs/heads/master
Commit: 5b37b5541869d1f84fe504dc55438102a8c4fd64
Parents: 0f24ec3
Author: shazron <sh...@gmail.com>
Authored: Mon Jan 16 16:20:54 2012 -0800
Committer: shazron <sh...@gmail.com>
Committed: Mon Jan 16 16:20:54 2012 -0800

----------------------------------------------------------------------
 PhoneGapLib/Classes/PGURLProtocol.m |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/5b37b554/PhoneGapLib/Classes/PGURLProtocol.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGURLProtocol.m b/PhoneGapLib/Classes/PGURLProtocol.m
index 7c2628d..3204507 100644
--- a/PhoneGapLib/Classes/PGURLProtocol.m
+++ b/PhoneGapLib/Classes/PGURLProtocol.m
@@ -9,6 +9,7 @@
 #import "PGURLProtocol.h"
 #import "PGWhitelist.h"
 #import "PGAppDelegate.h"
+#import "PhoneGapDelegate.h"
 #import "PGViewController.h"
 
 static PGWhitelist* gWhitelist = nil;
@@ -30,8 +31,12 @@ static PGWhitelist* gWhitelist = nil;
     NSString* theScheme = [theUrl scheme];
     
     if (gWhitelist == nil) {
-        PGAppDelegate* delegate = (PGAppDelegate*)[[UIApplication sharedApplication] delegate];
-        gWhitelist = [delegate.viewController.whitelist retain];
+        id delegate = [[UIApplication sharedApplication] delegate];
+        if ([delegate isKindOfClass:[PGAppDelegate class]]) {
+            gWhitelist = [((PGAppDelegate*)delegate).viewController.whitelist retain];
+        } else if ([delegate isKindOfClass:[PhoneGapDelegate class]]) {
+            gWhitelist = [((PhoneGapDelegate*)delegate).whitelist retain];
+        }
     }
     
     // we only care about http and https connections