How to debug IOS app with accessory attached - ios

I am writing an app that I need to see the xcode console output i.e. the following
2019-12-27 13:14:37.188270-1000 HelloDroneIOS13[2076:1783918] [arsdkengine] Create ArsdkEngine
2019-12-27 13:14:37.189316-1000 HelloDroneIOS13[2076:1783918] [gsdk.core] Loading engine ArsdkEngine
2019-12-27 13:14:37.189450-1000 HelloDroneIOS13[2076:1783918] [gsdk.core] Starting engines
2019-12-27 13:14:37.206437-1000 HelloDroneIOS13[2076:1783918] [gsdk.core.utility.internet] Started listening for Internet connectivity changes.
I have an accessory I need to attach so I can't have it connected to my laptop when running and it is crashing so I need to figure out the reason. I tried connecting it to my laptop after it crashed then from xcode Window->Devices and Simulators -> Open Console. See image:
This seems to only show the latest console outputs. Where can I access the saved outputs when it crashed? instead of the latest.

I have an accessory I need to attach so I can't have it connected to my laptop when running
Yes you can. Configure your device for wireless connection to Xcode. Now you can attach the accessory device and receive Console output at the same time. That is exactly why wireless Xcode debugging was invented.
(Check "Connect via network", visible in your screen shot.)

Related

React-Native: how to use "Remote JS Debugger" on real iOS-device?

I'm wondering if react-native's Remote Debugger mode would be possible also on real device. But it stops me with an error page stating
"Connecting to http://localhost:8081/debugger-proxy?role=client timed
out"
The interesting fact here is that this URL won't also work on my developer machine.
Opening this URL (http://localhost:8081/debugger-proxy?role=client) in a browser on my developer machine with running packager.js will respond with:
Cannot GET /debugger-proxy?role=client
When I turn off Remote debugger, everything works as expected.
Steps to reproduce:
react-native init testapp
cd testapp/ios
open the .xcodeproj-File with XCode
Select my connected iPhone as target device
Run the application
The application will fetch the source code from my local machine. In order to make this work, both, the iPhone-device and my iMac, are connected to the same WiFi.
The ReactNative-Application is executed on the iPhone as expected. With the shake-gesture I spawn the developer menu and select the option "Debug JS Remotely".
Now this error appears as mentioned above.
Following a side note in running-on-real device I changed the Host from localhost to the IP-Address of my Mac in RCTWebSocketExecutor.m, but this results in an endlos loop while fetching.
The Question is:
How can I use the Remote JS Debugging-Feature on real device?
Update
After further investigation I came to the conclusion that this might be a bug and opened the following issue on GitHub.
In chrome browser, I have changed
localhost:19001/debugger-ui
to
192.168.0.4:19001/debugger-ui
and it worked. Replace 192.168.0.4 with your ip address.
We had a similar issue here in 2020 and now there is a better solution which is to update the IP of the target machine directly from the app. Be on the same wifi with both the computer and the device - even if they are connected with a USB.
Shake the phone to get the menu
Select Configure Bundler
Insert the IP of the computer
Press Apply Changes
Now you should get debug data on the computer.
On iOS devices, open the file RCTWebSocketExecutor.m from react-native/Libraries/WebSocket/RCTWebSocketExecutor.m and change "localhost" to the IP address of your computer, (don't forget the correct port. eg: 192.168.1.6::8880) then select "Debug JS Remotely" from the Developer Menu.
NOTE: remove the app from your device, close the terminal that opened
for creating bundle.js. finally press the Play button from your Xcode.
here is the official guide from react-native website:

iOS Monitor like Android Monitor for debugging?

I'm new with iOS development. What I'm working out is how to get information about my app when I run it in iPhone.
For example: When I develop in Android, I connect my phone (with depuration mode) and open Android Monitor. So I can see if something went wrong an the monitor show me:
lines 425 nullPointerException ....
What's the problem? I built my hybrid app with HTML and Ionic in a Windows PC so I'm using Ionic View to show my app in my friend's iPhone.
Then I downloaded xCode in my friend's Mac and I'm trying to know whats wrong with my app because it show me a white screen.
So... May be, I can reach my app error if I could do something like a I described with my Android Monitor and find the error.
Thanks for helping!
There are several places to see errors and log output depending on what you are doing. If you are running your app via Xcode, then you can see the console output in the debug view - use the following button on the toolbar to open the debug view:
The debug view will appear at the bottom of the Xcode window and it can have two panes - a variable view, and the console output. The console output area will show ouptut from your app as it runs in Xcode. You can open/close the two panes by using the two buttons you will see the bottom right when the debug view is showing.
If you are not running your app via Xcode, then you can connect your device to your Mac via USB cable, and then in Xcode select Window - Devices from the Xcode menu. The new window you get will allow you to connect to your device and see the crash logs on the device. If your app is crashing, this should allow you to see the crash logs from your app.
Alternatively, you can see the console output (similar to Monitor on iOS) by running the Console app on your Mac while your iOS device is connected to the Mac. On the Console app sidebar, you should see your iOS device. If you select the device, you can see the console on the device, like this:
The above might show you what is happening in your app as it runs.
Hopefully, this helps :)

Can I reload my React Native application using a command?

I'm testing on a older iPhone and I have to shake the phone like a madman to get to the dev menu. Is there a command I can send through the bridge to reload or bring up the dev menu? I'm aware of live reload but that's not what I want.
For example on my Android device I can send adb shell input keyevent 82 to simulate a shake event and bring up the dev menu.
There is no way to open dev menu without shaking phone. Here is the issue related to this problem: https://github.com/facebook/react-native/issues/10191.
Nevertheless you can always try your code inside an iPhone emulator and open dev menu using ⌃⌘Z.
Best regards.

How to debug BlackBerry devices on Mac using the filesystem?

How exactly do you go about debugging BlackBerry apps that utilise the (BlackBerry's) filesystem on Mac?
I'm currently recording video and detecting when the video file appears on the file system, however due to the restrictions:
The BlackBerry file system is auto-mounted when plugged into a Mac
The app cannot access the filesystem when mounted
These two things have made debugging the app when it uses the filesystem.. impossible! We receive a file system error 1003 which according to the results from google mean it's mounted and you don't have access.
Is there a a simple way to get round this?
I also receive 63 signing emails from RIM. Woe is me
The workaround is a bit cumbersome, but it should work for you.
Implement EventLogger instance in your application.
Log all necessary info via EventLogger
Compile and run your app on the detached device from your computer.
Inspect log (press CTRL and hit LGLG on the device keyboard). As an additional option - automatically export log to a text file stored in the device filesystem (media card) to review it on your computer.

Tool to get BlackBerry log

For the iPhone there is a console tool for printing Nslog. For Android there is logcat. For Palm there is putty.
Is there any tool like this to print the log for BlackBerry?
The "javaloader.exe" command line tool, which comes with the developer tools (I think) can be used to extract data from the device's event logger. You can also press the Alt-lglg key sequence on the device (or simulator) home screen to see log entries locally (and copy them).
If you're trying to actually send data to the event log, look up the JavaDocs for the EventLogger class.
In addition to the methods octo explained, you can also just use "System.out.println" and as long as the simulator or device is connected to a debugger (JDE or Eclipose in debug mode), you will see the output in the debug window.
I am working on a Linux System and converting an Android App to Blackberry. I am using the Toolset available here:
https://developer.blackberry.com/android/
d.) Start ADB Proxy to connect a device or VMWare simulator through ADB to an Android development environment of your choice
>bin\blackberry-adbproxy [<device IP address>] [-detect] [-gui] [-password <device password>]
or
>bin\blackberry-adbproxy -gui
This tool allows me to get Logging Info from my Blackberry like I would get from an Android Device.

Resources