What are all the steps to run a XCUITest on a device? - ios

I can run XCUITests just fine on simulators, but when I try them on my device, the UITest icon is auto-clicked, and it fills the screen, freezes, then execution stops. The bug readout is "Test target GreetrUITests encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted).
Things I have tried:
1. Gone into my phone's settings -> developer -> enable UI Automation.
2. I don't have any cocoapods in my tests, only native XCUITests.
3. I have a provisioning profile for my app, I am able to run the app fine.
I might need to add a provisioning profile to the UITest but I don't know how to do that. I have also seen suggestions having to do with code-signing and paths, but I didn't understand the suggestions well enough to fix this.
I appreciate the help.

It works on my iphone 5s. I was using an iphone 5. iPhone 5 was released in 2012 which was 3 years before XCUITests were released in 2015 with xcode 7. I have xcode 9.0. Perhaps running UITests on iphone 5 is therefore deprecated.

Related

Instrument with iOS 9.3.1 [duplicate]

I have been trying unsuccessfully to profile my device (via Instruments) using the latest version of Xcode 7.0.1 (7A1001 released 9/28), as well as the previous version of Xcode 7 (7A218), as well as Xcode 7.1 Beta 2 (7B75).
My device is an iPhone 6+ with iOS 9.0.1 installed - the latest GM release of iOS9. I am able to run / debug applications on this device without issues.
In the screenshots below you can see that my device is disabled (greyed out) in all screenshots in all versions. I am able to profile other devices running iOS 8.4.1 without any issues.
Does the current version of Xcode not support profiling against iOS 9.0.1 or is there some kind of configuration setting or known work around for this?
Xcode 7.0.1:
Xcode 7.0:
Xcode 7.1 beta 2:
TL;DR - Perform a complete reboot of your device; restart Xcode & instruments; select "Open Xcode" if prompted to enable the device for development.
Update 3/31/2016: I haven't encountered any issues with the latest version(s) of Xcode (7.2.x, 7.3), so it seems that the stability here has been improved.
I believe I may have finally gotten this to work properly. Detailed steps:
Unplug the device from your Mac & power down the device completely (hold the power button for several seconds; slide to power off).
Close Xcode and Instruments.
Restart the device & once it has booted completely re-connect it to your Mac.
Re-launch Xcode. Here, my device showed as disabled and Xcode indicated that the device was not available for use.
Open your project; clean (Shift+Command+K), Build (Command+B), Profile (Command+I).
After Instruments launched I noticed that the device was enabled. Upon selecting it, a message was displayed with the title "Enable this device for development?" and message "This will open Xcode and enable this device for development." (Note that this only happened to me the first time I went through this process even though I had already been using the device for development - whereas some users have also reported that they are not presented with this dialogue.)
Click "Open Xcode". Here Xcode did not prompt me for anything nor was anything displayed - no additional messages indicating anything had been done or that the device was or was not available for development. Opening the Devices window, the device appeared to be available. (I have not been presented with this option for subsequent occurrences.)
Now I was able to select the device in Instruments and profile it.
As a side note, I was also again able to delete installed apps from the Devices window (I realized that this was not possible to do previously).
I'm unsure how my device ended up in this state however I will be on the lookout to see if this continues to occur.
Please note that this was done using Xcode 7.0.1.
Update: My device seems to lapse back into not being able to be used for profiling some time after performing these steps - I've had to reboot my device again in order for it to be available for profiling. Not sure what is triggering this behavior but I will file a Radar for this.
Close instruments -> reset your device by long pressing home and power button -> restart instruments. Works for Xcode 7.3.
According to Apple staff on the developer forums the behaviour of this issue is greatly improved in the Xcode 7.3 betas, so one easy solution is to try upgrading Xcode. I've upgraded and it seems to be behaving so far.
This issue still occurred with XCode 10.3 and iOS 12.4.2
I restarted the device only, and it worked.

Unable to profile app on device with iOS 9.0.1 using Xcode 7, 7.0.1 or 7.1 beta

I have been trying unsuccessfully to profile my device (via Instruments) using the latest version of Xcode 7.0.1 (7A1001 released 9/28), as well as the previous version of Xcode 7 (7A218), as well as Xcode 7.1 Beta 2 (7B75).
My device is an iPhone 6+ with iOS 9.0.1 installed - the latest GM release of iOS9. I am able to run / debug applications on this device without issues.
In the screenshots below you can see that my device is disabled (greyed out) in all screenshots in all versions. I am able to profile other devices running iOS 8.4.1 without any issues.
Does the current version of Xcode not support profiling against iOS 9.0.1 or is there some kind of configuration setting or known work around for this?
Xcode 7.0.1:
Xcode 7.0:
Xcode 7.1 beta 2:
TL;DR - Perform a complete reboot of your device; restart Xcode & instruments; select "Open Xcode" if prompted to enable the device for development.
Update 3/31/2016: I haven't encountered any issues with the latest version(s) of Xcode (7.2.x, 7.3), so it seems that the stability here has been improved.
I believe I may have finally gotten this to work properly. Detailed steps:
Unplug the device from your Mac & power down the device completely (hold the power button for several seconds; slide to power off).
Close Xcode and Instruments.
Restart the device & once it has booted completely re-connect it to your Mac.
Re-launch Xcode. Here, my device showed as disabled and Xcode indicated that the device was not available for use.
Open your project; clean (Shift+Command+K), Build (Command+B), Profile (Command+I).
After Instruments launched I noticed that the device was enabled. Upon selecting it, a message was displayed with the title "Enable this device for development?" and message "This will open Xcode and enable this device for development." (Note that this only happened to me the first time I went through this process even though I had already been using the device for development - whereas some users have also reported that they are not presented with this dialogue.)
Click "Open Xcode". Here Xcode did not prompt me for anything nor was anything displayed - no additional messages indicating anything had been done or that the device was or was not available for development. Opening the Devices window, the device appeared to be available. (I have not been presented with this option for subsequent occurrences.)
Now I was able to select the device in Instruments and profile it.
As a side note, I was also again able to delete installed apps from the Devices window (I realized that this was not possible to do previously).
I'm unsure how my device ended up in this state however I will be on the lookout to see if this continues to occur.
Please note that this was done using Xcode 7.0.1.
Update: My device seems to lapse back into not being able to be used for profiling some time after performing these steps - I've had to reboot my device again in order for it to be available for profiling. Not sure what is triggering this behavior but I will file a Radar for this.
Close instruments -> reset your device by long pressing home and power button -> restart instruments. Works for Xcode 7.3.
According to Apple staff on the developer forums the behaviour of this issue is greatly improved in the Xcode 7.3 betas, so one easy solution is to try upgrading Xcode. I've upgraded and it seems to be behaving so far.
This issue still occurred with XCode 10.3 and iOS 12.4.2
I restarted the device only, and it worked.

Xcode 6 doesnt build to device but says its running

I installed xcode 6 and was working on my app on simulator.
Now i have added push support it was time to start working on the device.
The problem is i cant get it to work. The device sits there and does nothing. Xcode says the app is running on the device but nothing happens.
When i click on "Running app on device" i can see its in the status of
"Validating Application "
The whole time...
I tried the solutions on SO but they are all for xcode 4 and some points about architechture and info.plist.
Checked both nothing wrong with it (testing on 5s, 7.1).
Tested other apps (got from github and so on), same problem cant run on device.
I think it has to do with xcode because all projects (big and small,old and new) don't work. I also tried on my ipad same problem.
So its not related to project or device.
Anyone has a solution ?
Removed xcode and installed it again. Works.
But to be honest since Xcode 4 this is the worst Xcode, allot of hangs and crashes. Need to force quit at least 6 times a day.

Unable to profile using Instruments on iPad 1 using XCode 5

I have an application built against iOS 7, but targeted for iOS 5.1 since I only have an iPad 1 available for testing. It's an all native library, with very minimal iOS dependencies. I am able to run the app on my iPad just fine, but when I try to Profile it, XCode 5 immediately changes the status to 'Finished running on iPad', and the Instruments window shows a warning saying 'This device does not support this instrument'. I see this behavior regardless of which instrument I choose from the Instruments panel.
I have tried other suggestions from similar issues posted on Stackoverflow such as
1. Cleaning my app and rebuilding
2. Restarting XCode
3. Deleting my app from the device
4. Changing the deployment target from 'iPhone/iPad' to just 'iPhone'
None of these have helped me get over this problem. Is there something fundamentally not supported in the configuration that I am trying to run ? Since the app runs correctly on the iPad, this seems like just a problem with Instruments compatibility, so I welcome any comments / suggestions on resolving this.
Thanks.

Xamarin 4.0.10 with Xcode 5.0 won't run on device but do run in simulator

I have that problem where I updated Xamarin and Xcode to their latest stable version.
My app will run on the Simulator, but won't run on the Device. It will install, then it will crash just after the Launch Screen, and it doesn't give any Error in the IDE.
I tried on another computer where Xamarin is on the same version, but Xcode is still on the 4.X ... and it launch with success and run as it should on the device.
So, is it just a problem with Xamarin and Xcode 5 compatibility ? Can I do something to fix that problem, any tips to solve this problem will be grateful.
What might be happening (that is happening to me) is that the resulting exe is too big.
I have an app that uses servicestack. Before xcode 4.6 it worked, after xcode 5 it does not work.
With Xamarin support and some research I realized that the "estimated size" for the "archive" in organizer was bigger than 62mb. Whenever that happens my app is killed before starting.
I am in the process of slimming down servicestack, but preliminarily it is working.
Bottom line: check the size of your exe. See limitation: Max size of an iOS application

Resources