Fixed startPage crash on a .framework based project.

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

Branch: refs/heads/master
Commit: d36c60edbb7f34a16a7289726e5e0f5a139ad82a
Parents: 01dfa7d
Author: shazron <shaz...@gmail.com>
Authored: Mon Jan 9 15:01:55 2012 -0800
Committer: shazron <shaz...@gmail.com>
Committed: Mon Jan 9 15:01:55 2012 -0800

----------------------------------------------------------------------
 PhoneGapLib/Classes/PGViewController.h |    2 +-
 PhoneGapLib/Classes/PGViewController.m |   38 ++++++++++++--------------
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d36c60ed/PhoneGapLib/Classes/PGViewController.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGViewController.h 
b/PhoneGapLib/Classes/PGViewController.h
index 565f8db..4be165d 100644
--- a/PhoneGapLib/Classes/PGViewController.h
+++ b/PhoneGapLib/Classes/PGViewController.h
@@ -24,7 +24,7 @@
 @property (nonatomic, readonly, retain) PGWhitelist* whitelist; // readonly 
for public
 @property (nonatomic, readonly, retain) NSArray* supportedOrientations;
 @property (nonatomic, readonly, copy)   NSString* sessionKey;
-
+@property (nonatomic, readonly, assign) BOOL loadFromString;
 
 
 + (NSDictionary*) getBundlePlist:(NSString*)plistName;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/d36c60ed/PhoneGapLib/Classes/PGViewController.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/PGViewController.m 
b/PhoneGapLib/Classes/PGViewController.m
index e857bce..e9f07cf 100644
--- a/PhoneGapLib/Classes/PGViewController.m
+++ b/PhoneGapLib/Classes/PGViewController.m
@@ -21,6 +21,7 @@
 @property (nonatomic, readwrite, retain) NSDictionary* pluginsMap;
 @property (nonatomic, readwrite, retain) NSArray* supportedOrientations;
 @property (nonatomic, readwrite, copy)   NSString* sessionKey;
+@property (nonatomic, readwrite, assign) BOOL loadFromString;
 
 @end
 
@@ -29,7 +30,7 @@
 
 @synthesize webView, supportedOrientations;
 @synthesize pluginObjects, pluginsMap, whitelist;
-@synthesize settings, sessionKey;
+@synthesize settings, sessionKey, loadFromString;
 
 
 // Implement viewDidLoad to do additional setup after loading the view, 
typically from a nib.
@@ -69,24 +70,21 @@
        
     self.pluginsMap = [pluginsDict dictionaryWithLowercaseKeys];
     
-       NSString* path = [PGViewController pathForResource:[self startPage]];
-       NSURL* appURL  = [NSURL fileURLWithPath:path];
-    
     ///////////////////
-
+    
+       NSString* startFilePath = [[self class] pathForResource:[self 
startPage]];
+       NSURL* appURL  = nil;
     NSString* loadErr = nil;
     
-    if(![appURL scheme]) {
-        NSString* startFilePath = [[self class] pathForResource:[self 
startPage]];
-        if (startFilePath == nil) {
-            loadErr = [NSString stringWithFormat:@"ERROR: Start Page at 
'%@/%@' was not found.", [[self class] wwwFolderName], [self startPage]];
-            NSLog(@"%@", loadErr);
-            appURL = nil;
-        } else {
-            appURL = [NSURL fileURLWithPath:startFilePath];
-        }
+    if (startFilePath == nil) {
+        loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' 
was not found.", [[self class] wwwFolderName], [self startPage]];
+        NSLog(@"%@", loadErr);
+        self.loadFromString = YES;
+        appURL = nil;
+    } else {
+        appURL = [NSURL fileURLWithPath:startFilePath];
     }
-    
+
     ///////////////////
     
     NSNumber* enableLocation       = [settings objectForKey:@"EnableLocation"];
@@ -352,11 +350,11 @@
     /*
      *    If we loaded the HTML from a string, we let the app handle it
      */
-//    else if (self.loadFromString == YES)
-//    {
-//        self.loadFromString = NO;
-//        return YES;
-//    }
+    else if (self.loadFromString == YES)
+    {
+        self.loadFromString = NO;
+        return YES;
+    }
     /*
      * all tel: scheme urls we let the UIWebview handle it using the default 
behaviour
      */

Reply via email to