Instruments can't attach to running process on iPhone - ios

I created a build for ad-hoc distribution of our product and installed the same on my device. Now I want to run the time profiler on the running process but Instruments is unable to attach to it. This is the error that I get when I try to attach to a running process on the iPhone:
Target failed to run : Could not attach to process <app-name> (<pid>)
I also tried "Choose Target" > app-name but that too failed with the following error:
Target failed to run : Remote exception encountered : 'Failed to get task for pid <pid>'
Here are the details of my setup:
OS X 10.7.2
Xcode 4.2.1 (Build 4D502)
Instruments 4.2 (4233)
iPhone OS 5.0.1 (Build 9A405)

I had the same problem. I didn't solve it initially, but an easy workaround is to launch the app yourself and then attach to it from the "Attach to Process..." command in the Target menu in the Instruments window.
After some digging around it seems this is a common topic of discussion on the apple developer forums: Instruments does not work on Xcode 4 with device
It appears that different Apple products will change/update the MobileDevice framework. Some of these updates break the Instruments integration.
To fix this on my own machine, I installed the iTunes 10.5 beta v6. Fire up XCode, and I'm back in business Instrumenting on my device.
I would recommend this tutorial since it is one of the better ones for explaining how to use Instruments
It can be very confusing at first, but take the time to get to know it and it'll ease a lot of headaches later.
Hope atleast one of these approaches work for you.

In Xcode 10: don't launch Instruments separately. Instead:
From Xcode’s menu bar, select Product\Profile, or press ⌘I. This will build the app and launch Instruments. You will be greeted with a selection window...
Full Tutorial
Note
If you do launch separately you'll get the failed to attach to target error with the recommendation to disable System Integrity.

Related

Xcode Instruments Unknown Addresses

I'm using the Xcode Instruments tool to Time Profile my application. Unfortunately, no matter how much I interact with the application while recording, I don't see a comprehensive break down of function calls in the profile. Instead, I see these <Unknown Address> [inlined] messages.
Running on Simulated iPhone on Mac:
Running on actual iPhone:
I verified that under the Xcode build options DWARF with dSYM File is selected for both Debug and Release and that the file exists. I'm using the IOS deployment target that matches the current version I have running on my iPhone and I have the latest (13.2.1) Xcode Command Line Tools selected.
I also took a look in Instruments > File > Symbols and noticed that there was a perms issue with what seems to be the CLT - not sure if this is at all related?
When I select the app name below Unknown, there isn't a dSYM path selected. However, every time I select it /Users/username/Library/Developer/Xcode/DerivedData/AppName-<sequence of characters>/Build/Products/Debug-iphoneos/AppName.app.dSYM I see a message "1 library will be symbolicated". However, this path doesn't seem to work because there is no behavior change in instruments AND it never sticks - it shows as empty if I open the window again.
Any suggestions would be greatly appreciated!

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

Xcode6 can't run any app in simulator ( Domain = NSPOSIXErrorDomain, Code = 3 )

No app can run in my simulator, although building is good.
Error messsage is below:
Unable to run app in Simulator
An error was encountered while running (Domain = NSPOSIXErrorDomain, Code = 3)
In my case, I tried to run the app on a iPhone 6 simulator when I got this error. Quitted the simulator only and re-ran the app on iPhone 5s (8.1) - it worked fine.
After a while I changed the target back to iPhone 6 (without quitting it), and ran the app against it - no error shown.
As mentioned in the Xcode 6.1 Release Notes and in my sticky post in the Apple Developer Forums for the iOS Simulator, this is a known bug in iOS.
Upon installation of an app, SpringBoard will SIGKILL that app's
process in order to force a relaunch of the app with the new
executable. The problem is that there is a race condition whereby
SpringBoard may accidentally SIGKILL a new process that we just
launched rather than the old process. Which of the various error
messages you get depends on exactly when in the launch process the
SIGKILL was delivered. Normally, this shouldn't happen, so the advise
is to just try again (sorry =/). If you find that this happes to you
all the time or more frequently than you can tollerate, we are
incredibly sorry. We are aware that systems with slower disk I/O will
see this happen more frequently than faster systems, so if you are
using an NFS home directory, you may want to create a local directory
for your simulator data and setup a simlink to it from
~/Library/Developer/CoreSimulator
By Quitting the Simulator and Run the application worked for me.
For me , just Reset Content and setting in your simulator
Restart Mac can solve the problem for me.
This error is less severe than "Domain = DTiPhoneSimulatorErrorDomain, Code = 2" error that I had when I switched to Xcode 6.
For this one, I just reset and cleared contents on my Simulator...quit. Rebuilt and ran my app...and it works.
Every time this has happened to me (as of this writing, still happening on Xcode 6.1) I do not need to restart my mac to fix it. Instead I only had to restart the simulator. I exit the simulator by right-clicking on its icon in the tray and selecting the option to Quit. The I re-run my app and the simulator starts from scratch and runs my app with no error. Much quicker than re-starting the mac.
Well, I had the same error popping up, but since I force quitted the simulator then ran the project again I got it fixed and running fine. Hope that helps you :)
If this error occurs with ionic framework, make sure you have an app id given in your config.xml
This is a generic error which says that it is unable to launch the app. The real error is in the log file. Go to the Simulator menu, Debug / Open System Log. Then press Reveal button to open the folder with actual Simulator logs. In my case it was CoreSimulator.log.
Here you will find the real error. My error was Could not register service com.apple.gputools.agent.producer.sim .
After a lot to struggle and trying all suggestions for half a day, I just went to simulator menu and chose File / GPU Selection / Use External GPU when available. That's it.
please download new xcode_6 beta 4. your project will work in simulator. As i have tested as well.
Sometimes the beta version of XCode is wrongly configured to use the command line tools from the previous xcode version.
This solution should fix the issue for you : https://stackoverflow.com/a/25415781/512504

How to get Instruments attached to simulator for UI Automation Testing

I'm trying to figure out how to do automated UI testing so that I can test my app for regression errors as I make changes and such. I'm following the instructions found in Apple's documentation. I built my app in Xcode and it is running in the iOS simulator.
I opened Instruments and chose the iOS Automation instrument. However, I can't seem to figure out how to get Instruments to run the script on my iOS app in the sim. When I first create the Automation instrument the target drop down just says "lkj" but if I try to choose the sim as my target, it tells me that the Automation instrument doesn't allow attaching.
How do I get Instruments to run my test on my iOS app?
I tried just running it with the "lkj" target selected and I got a weird error involving some random guy's name (I'm assuming he's a dev for Instruments or something?)
Path not found
'/Users/jonathan_morgan/Library/Developer/Xcode/DerivedData/lkj-randomstringofcharacters/Build/Products/Release-iphonesimulator/lkj.app/lkj
The simplest way to attach your target to the simulator and run your UIAutomation scripts is to profile the app. Xcode - Product - Build For - Profiling and then select the Automation template.
Another way to attach the target, if you've already built the app on your simulator. Is to select Choose Target and then go to the following location /Users/[yourUserName]/Library/Application Support/iPhone Simulator/[iOSVersion]/Applications/[AppFolder]/[NameOfYourTarget]
For more info, you can take a look at this blog which is pretty detailed http://blog.manbolo.com/2012/04/08/ios-automated-tests-with-uiautomation
Hope it helps.

use instruments - leaks with a device

I'm starting to use Instruments-Leaks with an iPhone 3G. When I try to run the app with Instruments on the iPhone I obtain
Target failed to run: Remote exception encountered: 'Failed to get task for pid 280'
Ideas?
The only time I succeed in running the app with instruments it run very slow, I couldn't test it.
What are the steps to run the app on the device searching for leaks?
The solution for me was to make sure that my Profile scheme was using the "debug" and not "release" build configuration.
In Xcode 4 select Product/Edit Scheme from the top menu
then click on the "profile" button on the left.
On the "info" pane you will see a setting for Build Configuration- set that to "debug"
This error is also thrown if you are trying to test your app on a device with a distribution profile selected. Make sure you have the correct code-sign settings for development.
You CAN profile the release build on the device. What you have to do is build the release build with a developer certificate. See here.
Instruments basically does its work by becoming the debugger for the app. If you can't run Xcode's debugger against it, then you can't run Instruments against it.
Mostly, entitlements need to be set to allow debugging.
Sometimes after using XCode to debug apps, I find I can't use Instruments until I reboot the device.
Unlike XCode, Instruments can be confused between two apps with the same name, but different bundle IDs. (Or perhaps same name and similar bundle IDs.) When I have multiple versions of an app on a device, I often have to delete the extra to get Instruments to connect to the correct app. If you have one debug build and one release build, this could be the problem.
So, delete any duplicates of your app and restart the device. (You could change the display name for release and debug build configurations.)

Resources