小编Gab*_*odo的帖子

Nativescript + iOS webview + 本地文件

我目前正在开发一个简单的应用程序,该应用程序有一个使用网络视图的 HTML 部分。

内容位于 app/www 文件夹中,我从“home.ts”组件访问它们,在 HTML 中使用类似的内容

<GridLayout
    class="main-layout"
    columns="*"
    rows="*"
>
    <WebView
        src="~/www/index.html"
        class="web-view"
        col="0"
        id="wv"
        row="0"
    ></WebView>
</GridLayout>
Run Code Online (Sandbox Code Playgroud)

该文件使用了一些图像、一些 JS 和一些 CSS。

它在 Android 上运行良好,但我无法使其在 iOS 上运行。哦,它在 iOS 模拟器上运行良好,但在实际设备中却不行(我目前有一个 iOS 9 iPod touch 来测试这些东西)。

我在 Info.plist 上配置了正确的密钥(它适用于https://www.google.com等 URL ),而且我认为我没有做任何奇怪的事情。

这是我的 package.json

{
  "description": "WebView App",
  "license": "LicenseRef-LICENSE",
  "readme": "README",
  "nativescript": {
    "id": "com.app.name"
  },
  "dependencies": {
    "@angular/animations": "~4.1.0",
    "@angular/common": "~4.1.0",
    "@angular/compiler": "~4.1.0",
    "@angular/core": "~4.1.0",
    "@angular/forms": "~4.1.0",
    "@angular/http": "~4.1.0",
    "@angular/platform-browser": "~4.1.0",
    "@angular/router": "~4.1.0",
    "nativescript-angular": "~3.0.0",
    "nativescript-theme-core": …
Run Code Online (Sandbox Code Playgroud)

webview local-files ios nativescript

5
推荐指数
1
解决办法
2722
查看次数

标签 统计

ios ×1

local-files ×1

nativescript ×1

webview ×1