0

Cant run app Nativescript on iOS but runs on android My code works ok android with no problems but in iOS i get those erros below. and i have no ideia why, what im missing ???? Its a plugin? Module? Any help would be good cuz im lost here. thanks when i run tns run ios --env.aot --env.uglify.

the erros i get when running the app :

***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x10fe3991f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x10fe71b60 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
3   0x110812dd6 ffi_closure_unix64_inner
4   0x1108137fa ffi_closure_unix64
5   0x114515d22 -[CALayer layoutSublayers]
6   0x11451a9fc CA::Layer::layout_if_needed(CA::Transaction*)
7   0x114526d58 CA::Layer::layout_and_display_if_needed(CA::Transaction*)
8   0x11449624a CA::Context::commit_transaction(CA::Transaction*)
9   0x1144cd606 CA::Transaction::commit()
10  0x116f942c3 __34-[UIApplication _firstCommitBlock]_block_invoke_2
11  0x115a97cbc __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
12  0x115a97480 __CFRunLoopDoBlocks
13  0x115a91d04 __CFRunLoopRun
14  0x115a914d2 CFRunLoopRunSpecific
15  0x11b8af2fe GSEventRunModal
16  0x116f7afc2 UIApplicationMain
17  0x11081363d ffi_call_unix64
18  0x12db4cf70
JavaScript stack trace:
1   @file:///node_modules/tns-core-modules/ui/content-view/content-view.js:44:0
2   _eachLayoutView@file:///node_modules/tns-core-modules/ui/core/view/view-common.js:1015:0
3   @file:///node_modules/tns-core-modules/ui/proxy-view-container/proxy-view-container.js:45:0
4   eachChildView@file:///node_modules/tns-core-modules/ui/layouts/layout-base-common.js:125:0
5   _eachLayoutView@file:///node_modules/tns-core-modules/ui/proxy-view-container/proxy-view-container.js:43:0
6   get@file:///node_modules/tns-core-modules/ui/content-view/content-view.js:38:0
7   onMeasure@file:///node_modules/tns-core-modules/ui/page/page.js:272:0
8   measure@file:///node_modules/tns-core-modules/ui/core/view/view.js:55:0
9   measureChild@file:///node_modules/tns-core-modules/ui/core/view/view-common.js:954:0
10  i@file:///node_modules/tns-core-modules/ui/core/view/view.js:636:0
11  viewDidLayoutSubviews@file:///node_modules/tns-core-modules/ui/page/page.js:192:0
12  UIApplicationMain@[native code]
13  S@file:///node_modules/tns-core-modules/application/application.js:277:0
14  run@file:///node_modules/tns-core-modules/application/application.js:305:0
15  bootstrapNativeScriptApp@file:///node_modules/nativescript-angular/platform-common.js:205:0
16  bootstrapApp@file:///node_modules/nativescript-angular/platform-common.js:106:0
17  bootstrapModuleFactory@file:///node_modules/nativescript-angular/platform-common.js:77:0
18  @file:///app/bundle.js:72:449
19  ./main.ts@file:///app/bundle.js:72:477
20  k@file:///src/webpack/bootstrap:750:0
21  n@file:///src/webpack/bootstrap:43:0
22  r@file:///src/webpack/bootstrap:30:0
23  anonymous@file:///src/$_lazy_route_resource lazy namespace object:2:0
24  evaluate@[nat<…>
JavaScript error:
file:///node_modules/tns-core-modules/ui/content-view/content-view.js:44:0 JS ERROR Error: More than one layout child inside a 
1   UIApplicationMain@[native code]
2   S@file:///node_modules/tns-core-modules/application/application.js:277:0
3   run@file:///node_modules/tns-core-modules/application/application.js:305:0
4   bootstrapNativeScriptApp@file:///node_modules/nativescript-angular/platform-common.js:205:0
5   bootstrapApp@file:///node_modules/nativescript-angular/platform-common.js:106:0
6   bootstrapModuleFactory@file:///node_modules/nativescript-angular/platform-common.js:77:0
7   @file:///app/bundle.js:72:449
8   ./main.ts@file:///app/bundle.js:72:477
9   k@file:///src/webpack/bootstrap:750:0
10  n@file:///src/webpack/bootstrap:43:0
11  r@file:///src/webpack/bootstrap:30:0
12  anonymous@file:///src/$_lazy_route_resource lazy namespace object:2:0
13  evaluate@[native code]
14  moduleEvaluation@:1:11
15  promiseReactionJob@:1:11
Kevin Dias
  • 1,043
  • 10
  • 28
  • Sounds like your root view has more than one layout. Please share your app component template. – Manoj Aug 30 '19 at 16:51
  • Aren't you using Angular? Because I see nativescript-angular in your logs, in which case it would be `app.component.html`. – Manoj Aug 30 '19 at 18:36
  • nothing special just ` ` – Kevin Dias Aug 31 '19 at 13:26
  • That looks okay, but one of your component that's being loaded seem to have more than one view at root level, at least by the error log. – Manoj Aug 31 '19 at 16:02
  • @Manoj soo by that it would run on Android and not iOS? – Kevin Dias Aug 31 '19 at 18:26
  • 1
    That's a good question but again that totally depends on your code. As @ian-macdonald mentioned, if you have placed conditions in your template, you have to check that too. Without code to reproduce the issue, I can't say much with a generic error log. – Manoj Aug 31 '19 at 18:30
  • @Manoj i did not place any condition ... but i will take a look at all components – Kevin Dias Aug 31 '19 at 19:27

2 Answers2

1

Somewhere in your source, usually at the root of a particular component's html/xml, you have a view that is only rendered on iOS. However, because it fails on iOS and not Android, it is likely that you have not placed the similar restriction on the other top-level element.

<ios>
  <Label text="only iOS"></Label>
</ios>

<Label text="only Android"></Label> <!-- Error; is present in template for both!! -->

It is hard for me to guess where exactly the issue might be, but I'd suggest having a look through your templates for the usage of ios.

Ian MacDonald
  • 13,472
  • 2
  • 30
  • 51
1

Well in ios u cant have free templates floating arround everything was too be inside a LayoutContainer

Android (Works) iOS (Don't Work)

<GridLayout>
 (... Content)
</GridLayout>

<GridLayout>
 (... More Content)
</GridLayout>

Android (Works) iOS (Works)

<GridLayout> // MAIN CHILD

 (... Content)

  <GridLayout>
   (... More Content)
  </GridLayout>

</GridLayout>
Kevin Dias
  • 1,043
  • 10
  • 28