Nativescript问题从NS 2迁移到3

时间:2017-09-14 22:32:26

标签: nativescript

尝试在Android上将我的应用从2迁移到3。

我下载了所有新要求。在新模板创建的项目上测试环境并且工作正常。

在我的项目中,我更新了tsconfig.js文件并修复了一些错误消息。

这些是我主要留下的 - 像:

这样的错误

属性'NSObject'在'Global'

类型中不存在

所有这些都与Global有关。

在代码中,我有类似global.NSObject

但“全局”似乎在NS 3.0中定义 - 在tns-core-modules / modules.d.ts中。

但是NSobject没有字段 - 错误。

我应该使用全局.__ native.NSObject ???

另外,我有一个工作线程,看起来签名发生了变化。

获取onmessage的错误以及postMessage()的签名似乎已经改变 - 文档中没有更新。

global.onmessage = function(msg) {}

一如既往的帮助。

我的package.json文件

{
    "description": "NativeScript Application",
    "license": "SEE LICENSE IN <your-license-filename>",
    "readme": "NativeScript Application",
    "repository": "<fill-your-repository-here>",
    "nativescript": {
        "id": "dev.myapp.test",
        "tns-android": {
            "version": "3.2.0"
        }
    },
    "dependencies": {
        "nativescript-dev-typescript": "^0.3.7",
        "tns-core-modules": "^3.2.0"
    },
    "devDependencies": {
        "babel-traverse": "6.19.0",
        "babel-types": "6.19.0",
        "babylon": "6.14.1",
        "lazy": "1.0.11",
        "nativescript-dev-typescript": "^0.3.7",
        "typescript": "~2.2.1"
    }
}

我的tsconfig.json

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "noEmitHelpers": true,
        "noEmitOnError": true,
        "lib": [
            "es6",
            "dom"
        ],
        "baseUrl": ".",
        "paths": {
            "*": [
                "./node_modules/tns-core-modules/*",
                "./node_modules/*"
            ]
        }
    },
    "exclude": [
        "node_modules",
        "platforms",
        "**/*.aot.ts"
    ]
}

0 个答案:

没有答案