Objective C is a very interesting programming language which offers a lot of power as well as interesting paradigms. Let’s look at some Objective C api’s and how they translate to NativeScript. In particular, let’s learn how to wire up iOS delegates using Filestack's FSPickerDelegate as an example. We will also look at handling WeakRef’s and iterating an NSArray.
Hey, I am getting this when trying to compile using npm start:
node_modules/typescript/lib/lib.es2015.collection.d.ts(31,11): error TS2300: Duplicate identifier 'MapConstructor'.
node_modules/typescript/lib/lib.es2015.collection.d.ts(68,11): error TS2300: Duplicate identifier 'SetConstructor'.
node_modules/typescript/lib/lib.es2015.iterable.d.ts(118,11): error TS2300: Duplicate identifier 'MapConstructor'.
node_modules/typescript/lib/lib.es2015.iterable.d.ts(135,11): error TS2300: Duplicate identifier 'SetConstructor'.
node_modules/tns-core-modules/declarations.d.ts(51,25): error TS2304: Cannot find name 'FormData'.
node_modules/tns-core-modules/declarations.d.ts(78,25): error TS2304: Cannot find name 'Blob'.
node_modules/tns-core-modules/declarations.d.ts(78,30): error TS2304: Cannot find name 'FormData'.
node_modules/tns-core-modules/declarations.d.ts(84,17): error TS2304: Cannot find name 'FormData'.
node_modules/tns-core-modules/es-collections.d.ts(15,5): error TS2687: All declarations of 'size' must have identical modifiers.
node_modules/tns-core-modules/es-collections.d.ts(19,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'Map' must be of type 'MapConstructor', but here has type '{ new <K, V>(): Map<K, V>; new <K, V>(m: Map<K, V>): Map<K, V>; new <K, V>(l: List<any>): Map<K, ...'.
node_modules/tns-core-modules/es-collections.d.ts(30,14): error TS2300: Duplicate identifier 'MapConstructor'.
node_modules/tns-core-modules/es-collections.d.ts(31,14): error TS2300: Duplicate identifier 'SetConstructor'.
node_modules/tns-core-modules/es-collections.d.ts(39,5): error TS2687: All declarations of 'size' must have identical modifiers.
node_modules/tns-core-modules/es-collections.d.ts(41,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'Set' must be of type 'SetConstructor', but here has type '{ new <T>(): Set<T>; new <T>(s: Set<T>): Set<T>; new <T>(l: List<T>): Set<T>; prototype: Set<any>...'.
node_modules/tns-core-modules/es-collections.d.ts(54,5): error TS2687: All declarations of 'value' must have identical modifiers.
node_modules/tns-core-modules/es6-promise.d.ts(98,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/tns-core-modules/es6.d.ts(7,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
node_modules/tns-core-modules/es6.d.ts(9,5): error TS2687: All declarations of 'iterator' must have identical modifiers.
node_modules/tns-core-modules/http/http.d.ts(86,24): error TS2304: Cannot find name 'FormData'.
node_modules/tns-core-modules/weakmap.d.ts(11,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'WeakMap' must be of type 'WeakMapConstructor', but here has type 'new <K, V>() => WeakMap<K, V>'.
My references.d.ts file looks like this:
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
and my build scripts look like this:
"scripts": {
"build.plugin": "tsc nativescript-filestack/filestack.ios.ts references.d.ts --lib es2016 -d true --experimentalDecorators true && tns plugin remove nativescript-filestack && tns plugin add nativescript-filestack",
"start": "npm run build.plugin && tns run ios"
},
I fixed this by copying the references.d.ts file and the tsconfig file from your repo. THen I started getting this weird error:
error TS2307: Cannot find module './app.module.ngfactory'.
Which I fixed by deleting that file altogether.