SAP Mobile Platform includes the Cordova 2.0 libraries. Follow these steps if you want to upgrade the iOS Hybrid Web Container to a more recent version of the Cordova library.
@property (nonatomic, strong) UIViewController* viewController;
-(void)setTheWebView: (UIWebView*) theWebView; -(void)setTheViewController: (UIViewController*) theViewController;
@synthesize viewController = _viewController;
#if 0 NSURL* appURL = nil; NSString* loadErr = nil; if ([self.startPage rangeOfString:@"://"].location != NSNotFound) { appURL = [NSURL URLWithString:self.startPage]; } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) { appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage]]; } else { NSString* startFilePath = [self.commandDelegate pathForResource:self.startPage]; if (startFilePath == nil) { loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage]; NSLog(@"%@", loadErr); self.loadFromString = YES; appURL = nil; } else { appURL = [NSURL fileURLWithPath:startFilePath]; } } #endif … #if 0 if (!loadErr) { NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0]; [self.webView loadRequest:appReq]; } else { NSString* html = [NSString stringWithFormat:@" %@ ", loadErr]; [self.webView loadHTMLString:html baseURL:nil]; } #endif
[plugin setViewController:self];with:
[plugin setViewController: self.viewController];
-(void) setTheWebView: (UIWebView*) theWebView { self.webView = theWebView; } -(void) setTheViewController: (UIViewController *)theViewController { self.viewController = (CDVViewController*)theViewController; }
self.whitelist = nil;
-(void)createGapView { #if 0 CGRect webViewBounds = self.view.bounds; webViewBounds.origin = self.view.bounds.origin; if (!self.webView) { self.webView = [self newCordovaViewWithFrame:webViewBounds]; self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); [self.view addSubview:self.webView]; [self.view sendSubviewToBack:self.webView]; _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self]; self.webView.delegate = _webViewDelegate; #endif // register this viewcontroller with the NSURLProtocol, only after the User-Agent is set [CDVURLProtocol registerViewController:self]; #if 0 } #endif }
self.viewController = nil;
[super viewDidLoad];
<feature name="AppLog"> <param name="ios-package" value="AppLogPlugin"/> </feature> <feature name="HttpsProxy"> <param name="ios-package" value="HttpsProxyPlugin"/> </feature>
#ifdef CORDOVA_FRAMEWORK #import <Cordova/CDVViewController.h> #import <Cordova/CDVContacts.h> #else #import "CDVViewController.h" #import "CDVContacts.h" #endif #endifwith:
#import <Cordova/CDVViewController.h> #import <Cordova/CDVContacts.h>
[CDVContacts setContactsAccessDelegate:self];
static BOOL s_bContactsChallengeInProgress = NO; + (BOOL) isContactsChallengeInProgress { return s_bContactsChallengeInProgress; } (void) requestContactsAccess { #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 60000 NSArray* versionCompatibility = [[UIDevice currentDevice].systemVersion componentsSeparatedByString:@"."]; NSInteger iMajorVersion = [[versionCompatibility objectAtIndex:0] intValue]; if (iMajorVersion >= 6) { if (ABAddressBookGetAuthorizationStatus() == kABAuthorizationStatusNotDetermined) { s_bContactsChallengeInProgress = YES; ABAddressBookRef addressBookRef = ABAddressBookCreateWithOptions(NULL, NULL); ABAddressBookRequestAccessWithCompletion(addressBookRef, ^(bool granted, CFErrorRef error) { s_bContactsChallengeInProgress = NO; }); CFRelease(addressBookRef); } while (s_bContactsChallengeInProgress) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; [pool release]; } } #endif }
bPresentingContactsChallenge = [HWCAppDelegate isContactsChallengeInProgress];
(void) requestContactsAccess;