Lost connection to iPad - ios

When I run my iOS application in the iPad for the first time in Xcode 6.0.1, I get this error message:
Lost connection to "iPad 2". Restore the connection to "iPad 2" and run "App Name” again, or if "App Name" is still > > running, you can attach to it by selecting Debug > Attach to Process > App Name.
What should I do to fix this problem?

Try it.
This happens when you have 2 projects open in XCode you want to debug at same time.
To reproduce the problem:
Launch a program in debug on the i(whatever)(iPad or iPhone) device .
Go to another (dependency) project and select Debug -> attach to process -> process launched at 1.
To avoid the problem:
Launch the main process straight from the device
Go to the dependency project and select Debug -> attach to process -> process launched at 1.
Same problem is addressed here with the same answer.
Lost connection to “iPad 2”

Related

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]

Get (console?)logs from iPhone Settings app

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

Lost connection to "iPad 2"

I have stopped all simulator processes but still getting below error.
Restore the connection to "iPad 2" and run "APPNAME" again, or if "APPNAME" is still running, you can attach to it by selecting Debug > Attach to Process > APPNAME.
Getting this error in Xcode 6,which is not consistent,but need to build it once again.
Please drop reasons if someone knows.
This happens when you have 2 projects open in XCode you want to debug at same time.
To reproduce the problem:
Launch a program in debug on the i(whatever) device
Go to another (dependency) project and select Debug -> attach to process -> process launched at 1.
To avoid the problem:
Launch the main process straight from the device
Go to the dependency project and select Debug -> attach to process -> process launched at 1.

Lost connection to "iOS Simulator" for the first time in Xcode 6.0.1

When I run my iOS application in the Simulator for the first time in Xcode 6.0.1, I got this error message:
Lost connection to "iPad 2".
Restore the connection to "iPad 2" and run "App Name” again, or if "App Name" is still > > running, you can attach to it by selecting Debug > Attach to Process > App Name.
Can any one suggest how I can solve this error message? After I stop running and rebuild, everything works fine.
Follow 2 steps :
1- sudo DevToolsSecurity -enable
2- Edit Scheme -> Run -> Debug excitable , uncheck this checkbox it will be ok !
You will now be able to run on simulator. This worked for me.
Same here. I thinks that is the bug of XCode.
Just stop running and Run Again. This way is working fine for me.
This is a known issue with iOS 8.0 and earlier, but changes in iOS 8.0 make the issue more likely to occur than in past versions.
In addition to the lost connection message, other appearances of this bug will be an ESRCH error message (POSIX domain, 3 code), an FBS* domain with code 4, or your app getting SIGKILL and dropped to debugger. I think there may be one more message for this bug, but those are the main 4 behaviors. Which one you gets depends on exactly what point in the launch you lost the race.
At present, the workaround is just to retry Build&Run or launch the installed app in the sim and attach to the running process with the debugger.
Reseting the simulator content and settings would solve the problem. From iOS Simulator drop down select Reset Content and Settings, after that build and run again. I hope that helps.
This happens less frequently in Xcode 6.2 as compared to Xcode 6 beta version.
Only solution is to Re-run your project. This seems to be bug.

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