Get (console?)logs from iPhone Settings app - ios

I've never used, let alone debugged, an iPhone until today - please be gentle.
I'm trying to install onto an iOS 8 iPhone a VPN configuration .mobileconfig file of my own creation, and it is failing. I was fully expecting not to get it right first time - now I need to debug it.
How can I get logs of the failure please?
I have not been able to find a working app in the App Store. "LogPolice", for example, just shows an empty log.
XCode on a Mac refuses to connect to the process. I select Debug -> Attach to Process -> Settings (xx) and it tells me
Lost connection to "iPhone".
Restore the connection to "iPhone" and run
"Settings" again, of if "Settings" is still running, you
can attach to it by selecting Debug > Attach to
Process > Settings
Retrying, restarting XCode, restarting the mac, restarting the phone have no effect.
I have at my disposal a Mac, a Windows PC (for which I do not have admin rights) and a Ubuntu VM (for which I have admin rights). Happy to use any of them.

You can't debug the settings app as it's not an app you'll have the debug symbols for.
You can view the devices console which should shed some more light on the issue. See this reddit comment to locate it in Xcode: https://www.reddit.com/r/iOSProgramming/comments/294kj4/where_did_the_console_from_devices_go_in_xcode_6/cihel8l

Related

Deploying Xamarin.Forms app to iOS: MT1006 EOF Error (error: 0xe800000e)

I am trying to run a Xamarin.Forms app on my iPad and getting the following error:
Launch failed. The app 'AppIOS' could not be launched on 'My iPad'. Error: error MT1006: Could not install the application '/Users/mycompany/Library/Caches/Xamarin/mtbs/builds/AppIOS/someguid/bin/iPhone/Debug/my.app' on the device 'My iPad': EOF Error (error: 0xe800000e).. Please check the logs for more details.
This app has previously ran fine on the same device. The iOS build and deployment process seems very unstable so it often takes multiple attempts so I'm used to having to restart Visual Studio, the Mac it builds on and the iPad and generally wasting a whole lot of time. I have restarted everything involved here multiple times but this error persists. I have checked the device logs and there are no related messages or even any messages at the appropriate times.
I'm using Visual Studio 2017 (15.9.4), Xamarin.iOS and Xamarin.Mac SDK (12.2.1.12), building on a Mac Mini running macOS Mojave and XCode 10.1, deploying to an iPad Air (A1474) running iOS 12.1.1. As far as I'm aware there have been no updates to any of these since I last had it working. The UWP version of the app runs fine.
I can find a lot of MT1006 issues but none with EOF Error (error: 0xe800000e) and I can find no information about this specific error at all. Can anyone enlighten me on what this means?
Sounds overly simple, but I just had this issue and I solved it by restarting the iOS device and redeploying it. Specifically, I was deploying to an iPod 6th Gen and I held the power and home buttons until the screen turned black, this is more of a hard restart. Then let the device reboot and try deploying again.
NOTE: Don't hold the power and home buttons too long, because if you do, the iPod will go into a factory reset restart.
Try pulling up the device in Xcodes' devices tab. I did and realized the device had an error within the tab. I then disabled the "Connect via network" button, then things started to work properly.
I am agree, Xamarin build environment on iOS part is very buggy.
In any case of unknown error in such config: VS<->MAC<->iOS Device try these steps:
Try to switch Off and On Mac wifi.
Reconnect VS to Macbook and Macbook to IPhone.
Delete bin and obj folders on Macbook
Check your PList and Entitlements file(as example wrong aps-environment setting can cause installing errors)
Check your sign project settings
5a. Check your provisoning profile term
unistall application from ios
rebuild and run project again
I'll appent new lines in case i'll remember something else.
What you described happened to me and solved by 1,2,7

iOS - Xcode Error: cannot attach to process due to System Integrity Protection

When I running an application shared extension from XCode run button and then trying to share files, XCode shows the below error frequently. Anyone have any idea whats causing it?
Error: "cannot attach to process due to System Integrity Protection"
System Integrity Protection(SIP) aka rootless is a new security feature in OS X 10.11. By default it disables even the administrator to access/modify the root. Follow these steps to disable SIP:
Restart your Mac.
Before OS X starts up, hold down Command-R and keep it held down until you see an Apple icon and a progress bar. Release. This boots
you into Recovery.
From the Utilities menu, select Terminal.
At the prompt type exactly the following and then press Return:
csrutil disable
Terminal should display a message that SIP was disabled.
From the  menu, select Restart.
You can re-enable SIP by following the above steps, but using csrutil enable instead.
In some cases, if you are trying to connect to a "system provided" executable (for example, Terminal.app) there is a workaround by making a copy of such executable. The copy will be checked by SIP as "user installed" instead of "system provided".
For an example, see
"Launching the Terminal app from Xcode on OS X with System Integrity Protection"
Sometimes I also get this error on Xcode while trying to run an app on simulator. Usually I only run the app again, and at most I restart the simulator, and it solves the problem.
Be aware of the security risks you're incurring on disabling SIP (System Integrity Protection):
https://support.apple.com/en-us/HT204899

Testing a closed ios app

I'm currently trying to handle different application states (closed, background or in a different tab of the app) however when I try to test how the app works when it is closed and receives a push notification(double click home and force close the app then reopen it) I'm not sure where I'm going wrong in the code. Since I'm reopening the app from the phone itself and not xcode I can't test to see which method isn't being reached because no output is available in the console. Is there any way to test a situation like this or simulate a force close event in xcode so that when i re run the app on the phone it also launches in xcode?
I appreciate any responses.
Cheers!
If you force close app or stop (from xcode) then it close the connection with xcode. Then if you open it from phone then it will not make connection with xcode. You must run it from xcode. And there is no difference in opening app from phone or running from xcode. App's flow will be same in both case. So what you want to test that which methods get calls and in which sequence that you can check by rerunning the project.
Update:
Select the Scheme on the toolbar (just left beside from your device or simulator list)
Choose Edit Scheme
Select Run in the left panel
For the Launch option, select Wait for executable to be launched
Refer this link for more details
Since I'm reopening the app from the phone itself and not xcode I can't test to see which method isn't being reached because no output is available in the console.
In Xcode, hold down the Option key and choose Product->Run..., and then edit the Run scheme to use the "Wait for executable to be launched" option. You should then be able to choose Run in Xcode, and then open your app by some other means, such as responding to a notification, and Xcode will still connect and let you debug.
To debug the process after restarting the app again, attach the Xcode debug console to the running process.
In Xcode do:
Debug > Attach to process > [select your process]

How can I debug an iOS app executed in mobile not launched by Xcode?

I am developing an application for iOS in Objective C with Xcode. This application schedules local push notifications every 6 hours and it is crashing when I open the push notifications.
I need to debug the error to solve it. I can have the mobile connected to Xcode, but as the app is executed from local push notification I can't see the error messages on my Xcode debug console, as I haven't launched my app from Xcode.
Is there a way to have the iOS device connected to my Mac and see what error is happening?
I know that I can go to the mobile settings to view logs, but these logs are too ambigous for me aren't giving any error.
In addition to opening the console log as described by #saurabhgoyal you can tell Xcode to wait for your app to launch and then attach the debugger to it when it does.
Select the scheme you're using to build your app, select edit scheme, and click on the run icon. Then Look for a pair of radio buttons titled "Launch" and select the one with the name "Wait for executable to be launched."
Then when you run your app in Xcode it builds it and installs it on the device but does not launch it.
When your notification fires and the app launches the debugger attaches to your app and you can debug as normal (except that NSLog statements don't print to the debug console any more - an annoyance.)
Yes there is a way to see device logs on Mac.
Connect your iOS device to the Mac system using USB
Launch Xcode–>Window–>Devices
Select your device from the left panel
Now you can see the logs on the screen including the background activities.
In order to save the running logs.
Reproduce the issue or start working on your device on a the app you wanted to capture the logs. After the issue is reproduced click on the Save Console icon bottom right corner Xcode screen
For more details please visit this link
Hope this Helps!
Check your crash log
1.Launch Xcode on your desktop machine.
2.Open the Xcode Devices window. (Window menu -> Devices and Simulators, or Cmd-Shift-2.)
3.Find your device in the left sidebar, then select “device logs”.
Choose a Chrome crash (or multiple crashes) and select “Export” at the bottom of the Organizer window.

How to attach debugger to iOS app after launch?

I have an issue I am troubleshooting which occurs very infrequently and doesn't seem to happen when I have things running under Xcode.
Is it possible to run an app normally (i.e. from Springboard) until my issue occurs, and then attach a debugger at that point?
I would prefer to do this without jailbreaking if possible.
Attach your device connected your Mac
Debug > Attach to Process by PID or Name
In the dialog sheet, enter the name of your App as it appears in the Debug navigator when started via Xcode (e.g. Target's name not bundle-id).
If the app is already running, the debugger will attach to the running process. If it isn't running, it will wait for the app to launch and then attach.
I'll leave this here since neither of the other 2 answers gave me quite enough detail without a little bit of a struggle.
Run your app in the simulator and take note of the name in the Debug navigator
Plug in your device and don't forget to select your device as the target
Debug > Attach to Process > By Process Identifier (PID) or Name
Enter the name from step 1 and attach. That should be all you have to do.
In Xcode 5.0.1 and 6 it's the menu bar items:
Debug > Attach to Process > By Process Identifier (PID) or Name...
In Xcode 7 it's just:
Debug > Attach to Process by PID or Name...
I was able to debug the app by adding a breakpoint on the AppCoordinator file init() method on the super.init() line.
I was able to turn off the wifi/internet and then by pass the developer verification.

Resources