nativescript-cli icon indicating copy to clipboard operation
nativescript-cli copied to clipboard

NS7 App iOS 14 Simulator no console or trace output

Open acutedeveloper opened this issue 4 years ago • 6 comments

Environment nativescript has 7.1.0 version and is up to date. @nativescript/core has 7.1.0 version and is up to date. @nativescript/ios has 7.1.0 version and is up to date. @nativescript/android has 7.0.1 version and is up to date.

Node v14.15.2 / NPM v6.14.9 Xcode 12.2 Big Sur 11.1

Mac Mini (M1 2020) Curious to know if my hardware would have an effect on this issue?

Describe the bug When running an app in the iOS 14 simulator, I cannot see any console.log or Trace.write. If I run a 13.X Simulator I can see

To Reproduce Create a hello world app using ns create

Run the app in the iOS simulator any device.

app/main-view-model.ts

import { Observable, Trace } from '@nativescript/core';

//...

onTap() {
        this._counter--;
        this.updateMessage();
				alert('tapped'); // Works
				console.log('logged console'); // Does not work
				Trace.write(
					"Trace shown to console",
					Trace.categories.Debug
				); // Does not work
    }


Expected behavior For the console log and trace messages to show in the terminal that is running ns run ios

As you can imagine this makes debugging projects painful!!

Any insight appreciated.

acutedeveloper avatar Dec 30 '20 13:12 acutedeveloper

I'm having the same issue using a M1 Macbook Pro with the same software versions as above.

jelledijkstra97 avatar Jan 13 '21 14:01 jelledijkstra97

My only solution was to run iOS 13 to see the console.logs

acutedeveloper avatar Jan 14 '21 17:01 acutedeveloper

Any progress with this? I too am on an M1 Macbook Air and cannot see any logs on an iOS14 simulator, however can on iOS13.

Node: 14.15.4 npm: 6.14.10 OS: Big Sur 11.1 Xcode: 12.3 ns -v: 7.1.2

matty0005 avatar Jan 26 '21 03:01 matty0005

Ugh, i was pretty sure i sent an answer before my m1 mba got fried.

Using ios13 isn't exactly a solution since some libraries crash the emulator specially. on big projects. If you build through xcode the logs appear on the debugger so its something between the ios simulator app and the ns cli. I've been poking around but haven't been able to find the cause.

Meanwhile you can use this on a terminal (pipe it to sed/awk to remove log date/etc). And it will print out the logs. (What i do is run it on background so i can keep everything on a single terminal)

log stream --level debug --predicate 'senderImagePath contains "NativeScript"'

PolCPP avatar Feb 05 '21 02:02 PolCPP

the console log shows up when I pair my M1 laptop with my iPhone running 14.4. This is my workaround for now.

linuxsimba avatar Feb 07 '21 20:02 linuxsimba

I got console.log() to work on the simulator with iOS 14.5, NS 7.2.2 with an M1 laptop.

qnguyen18 avatar May 21 '21 23:05 qnguyen18