facebook/flipper

Question: iOS Logs are not visible in client

Closed this issue ยท 16 comments

I've completed setup for app. I see Layout/Network/SharedPreferences plugins and they work. But i don't get any logs Logs (print,nslog,oslog). It is working only for android. Is it a bug or i've setup something else?

passy commented

There shouldn't be anything you need to setup. @priteshrnandgaonkar do you have any ideas how to debug this?

I am having a similar issue. I can't see any logs for a physical ios device. For a simulator, I see some log messages but not custom log messages written in the app. The log messages I see seem to be coming from the phone os itself.

Apologies for the late reply. It works for me. I built the Flipper app from the source. yarn && yarn start and it showed the custom NSLog which is added in the AppDelegate here

Screen Shot 2019-08-19 at 8 30 58 PM

Can you open the console (cmd + option + i) and check if there is any error ?

I'm using latest version 0.23.4 (installed, autoupdated)

adbClient.js:42 Failed to create adb client using shell adb command. Trying with adbkit.
Error: Command failed: /opt/android_sdk/platform-tools/adb start-server
/bin/sh: /opt/android_sdk/platform-tools/adb: No such file or directory

(anonymous) @ adbClient.js:42
adbClient.js:59 Failed to start adb client. Retrying. spawn adb ENOENT
(anonymous) @ adbClient.js:59
androidDevice.js:84 Error: Command failed: /opt/android_sdk/tools/emulator -list-avds
/bin/sh: /opt/android_sdk/tools/emulator: No such file or directory

    at ChildProcess.exithandler (child_process.js:308)
    at ChildProcess.emit (events.js:194)
    at maybeClose (internal/child_process.js:998)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:265)
(anonymous) @ androidDevice.js:84
adbClient.js:59 Failed to start adb client. Retrying. spawn adb ENOENT
(anonymous) @ adbClient.js:59
adbClient.js:59 Failed to start adb client. Retrying. spawn adb ENOENT
(anonymous) @ adbClient.js:59
adbClient.js:59 Failed to start adb client. Retrying. spawn adb ENOENT
(anonymous) @ adbClient.js:59
adbClient.js:59 Failed to start adb client. Retrying. spawn adb ENOENT
(anonymous) @ adbClient.js:59
internal/process/warning.js:23 (node:2348) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
writeOut @ internal/process/warning.js:23
IOSDevice.js:94 Error from getpwuid_r: 102 (Operation not supported on socket)

(anonymous) @ IOSDevice.js:94
adbClient.js:59 Failed to start adb client. Retrying. spawn adb ENOENT
(anonymous) @ adbClient.js:59
androidDevice.js:146 Failed to watch for android devices: spawn adb ENOENT
(anonymous) @ androidDevice.js:146

There is no log from print or NSLog, i'm using swift not objective c in project if that makes a difference

My init:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
       let client = FlipperClient.shared()
       let layoutDescriptorMapper = SKDescriptorMapper(defaults: ())
       FlipperKitLayoutComponentKitSupport.setUpWith(layoutDescriptorMapper)
       client?.add(FKUserDefaultsPlugin())
       client?.add(FlipperKitNetworkPlugin(networkAdapter: SKIOSNetworkAdapter()))
       client?.add(FlipperKitLayoutPlugin(rootNode: application, with: layoutDescriptorMapper!))
       client?.start()
       return true
   }

I am able to reproduce the issue on the swift sample app. Let me see what is the issue.

Can confirm. I'm having a difficult time getting iOS Simulator to work as well.

Initialized via

react-native init reactNative610Rc --version react-native@0.61.0-rc.0

Android logs show just fine, but not iOS.

Same for simulator (not even app-specific). Android simulator logs show, but not iOS

the problem is with the swift apps not with an objective c apps.

I could see NSLOG but console.log is not showing

console.log won't show up in the Logs plugin. @mweststrate, are console.log in hermes debugger ?

console.log should show up in the Logs plugin under the React Native device, that should show up as soon as you start metro (in RN 0.62+) (They will not show under the physical device, that one only shows the IDB / ADB logs)

If it's your first time running Flipper, restart it.

It did not initially work for me either. The only thing that showed up in Flipper was a single dep_graph_loaded event. Layout, Network, React DevTools all worked fine. The Restart and Menu buttons at the top left did nothing.

Restarting Flipper fixed everything.

The Plugin Status tab under Manage Plugins still complains it cannot connect to my actual app though, but I don't appear to be having any issues.

Hi, I'm trying to read console.log via the React Native Logs plugin, but it says 'client_log : JavaScript logs will appear in your browser console'.

Also it always opens a Chrome tab for 'http://localhost:8081/debugger-ui/'.

I thought Flipper would replace that.

any thoughts ?

P.S.: Ok, I disabled debug on the device and now it works

I can confirm that disabling debugging in the 'shake' menu results in the logs showing up just fine (warn, debug, etc), however, now I cannot debug in my IDE anymore :D

Any idea why debugging mode would block logs from coming through?

I'm using Sentry, and its initialization logs are coming through just fine, but only in the device logs, not the React Native logs.

stale commented

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

stale commented

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.