如何使服务器页面与cordova交互

时间:2016-06-23 05:13:03

标签: cordova oracle-apex hybrid-mobile-app

我正在使用cordova 6.0开发移动应用程序。 在它的第一页(/www/index.html)上有一个重定向到我的Web应用程序的第一页。

在服务器上我使用oracle application express,这样我就可以非常轻松地开发我的移动应用程序,但关键是我没有在服务器上使用cordova而我无法使用移动设备本机功能,如相机。

我需要将哪些必要文件上传到我的服务器,或者让我的Web应用程序服务器与cordova交互并获取移动本机功能的其他操作?

这实际上是我想在申请的第一页中做的事情:



- (void)initView {
    self.navigationController = [[UINavigationController alloc] init];
    [self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
    [self.navigationController.navigationBar setBackgroundImage:[[UIImage imageNamed:@"bakground1"]init] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.tintColor = [UIColor hx_colorWithHexRGBAString:@"#332532"];
    [self initializeSearchController];
    self.webView = [[MapWebView alloc] initWithFrame:CGRectMake(0, 100, widthtScreen, heightScreen)];
    self.webView.mapWebViewDelegate = self;
    [self addSubview:self.webView];
}


- (void)initializeSearchController {
    UITableViewController *searchResultsController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
    searchResultsController.tableView.dataSource = self;
    searchResultsController.tableView.delegate = self;
    self.searchController = [[UISearchController alloc] initWithSearchResultsController:searchResultsController];
    self.navigationController.definesPresentationContext = YES;
    self.searchController.hidesNavigationBarDuringPresentation = false;
    self.searchController.accessibilityElementsHidden= true;
    self.searchController.dimsBackgroundDuringPresentation = true;
    self.searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, self.searchController.searchBar.frame.size.width, 44.0);
    self.navigationController.navigationItem.titleView = self.searchController.searchBar;
    self.searchController.searchResultsUpdater = self;
    self.searchController.searchBar.delegate = self;
}




1 个答案:

答案 0 :(得分:1)

实际上,您正在尝试从服务器加载页面并使它们与phonegap之类的本机功能进行交互,但是当您尝试将phonegap框架集成到服务器页面时会出现问题。简单地说,您不能这样做,因为即使您将包含cordova.js,它也无法与对本机功能至关重要的原生文件进行交互。

相关问题