Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target failed to run: The operation couldn’t be completed. #69

Open
clacladev opened this issue Oct 31, 2014 · 9 comments
Open

Target failed to run: The operation couldn’t be completed. #69

clacladev opened this issue Oct 31, 2014 · 9 comments

Comments

@clacladev
Copy link

Hi Jonathan,
thanks for this great script. I really appreciate your work.

I have only one problem. Half of the time when running the script I get the error:

$ ./ui-screen-shooter.sh
[...]
Running automation script "./config-automation.js"
          for "iPad 2"
          in language "en-US"...
Waiting for device to boot...
2014-10-31 15:09:32.009 instruments[44646:1015886] WebKit Threading Violation - initial use of WebKit from a secondary thread.
Instruments Trace Error : Target failed to run: The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 8.) : Failed to launch process with bundle identifier 'com.xxx.yyy'

After few tries, I've understood that resetting the simulator and re-running the script it works fine.

$ ./ui-screen-shooter.sh
[...]
Running automation script "./config-automation.js"
          for "iPad 2"
          in language "en-US"...
2014-10-31 15:10:31.981 instruments[44764:1017855] WebKit Threading Violation - initial use of WebKit from a secondary thread.
2014-10-31 15:10:34 +0000 Debug: target.captureRectOnScreenWithName("{origin:{x:0.00,y:0.00}, size:{height:1024.00,width:768.00}}", UIScreen, "iOS-iPad___portrait___WelcomeScreen")
2014-10-31 15:10:34 +0000 Screenshot captured.
Instruments Trace Complete (Duration : 3.712188s; Output : /tmp/screen_shooter/traces/trace.trace)

Then problem is that it's unpredictable, so I have to reset the simulator a lot of times.
Do you have any idea why this is happening?

I have Xcode 6.1 with an app that run exclusively on iOS 8.1.

Thanks

@jonathanpenn
Copy link
Owner

The "WebKit Threading Violation" seems weird. Does that happen when you run your app outside of instruments every once in a while?

Unfortunately, Instruments and UI Automation is still not very stable. File a bug with Apple at http://bugreport.apple.com and include these log files and let them know you're using this script. Every bug report helps prioritize things.

@clacladev
Copy link
Author

Yes, it happens when I run it from terminal.

I've noted that it happens when is switching from a simulated device to another. If I am running just on one device it's unlikely it happens.

@jonathanpenn
Copy link
Owner

I meant, does it happen if you run it while just using the app normally (run from Springboard, not just from the terminal)? Regardless, this sounds like an issue within Apple's profiling toolchain. Instruments sometimes just loses connection with the frontmost app, too. The Instruments team is still working out kinks to make it robust. There's nothing that these screen shot scripts can do from the outside. We have to wait for the toolchain.

Please file a bug about this and update the thread with any details if you can. Thanks!

@clacladev
Copy link
Author

It happens only when running the script. So when the script switch from a device type to another, probably as you said lose connection and the error is thrown.

Anyway, thanks for your answer and support. I will fill the bug report with Apple.

Have great work and thanks again for the script.
Cheers

@KrauseFx
Copy link
Contributor

KrauseFx commented Nov 9, 2014

I'm having the exact same problem. Only way to 'solve' it, is to wait for a few seconds and try to run it again. I'm currently working on a fix for that issue. I think it has nothing to do with Webkit itself, that's just a warning from a different problem.

@KrauseFx
Copy link
Contributor

@ccarnino Sorry to just advertise another open source project, but Snapshot solves exactly this problem.

Take a look at the gif: Instruments failed again... trying again. That's when Snapshot detects this error and tries again.

@KrauseFx
Copy link
Contributor

In case you want to implement this fix in ui-screen-shootercheck out runner.rb:87

It's enough to re-run this one test after a few seconds delay.

@clacladev
Copy link
Author

Thanks Felix for the advice.
I will try this for sure to see if the overall process works better.

Cheers

-- 
Claudio Carnino
Co-founder of Fanchimp.com
About me on TuguLab.org

"We want the world and we want it now" The Doors

On 15 November 2014 at 12:27:29, Felix Krause ([email protected]) wrote:

In case you want to implement this fix in ui-screen-shootercheck out runner.rb:87

It's enough to re-run this one test after a few seconds delay.


Reply to this email directly or view it on GitHub.

@damcify
Copy link

damcify commented Dec 2, 2014

I added this crude code myself. Seems to work... not fully tested yet though.

 until "$DIR"/unix_instruments.sh  
 -w "$simulator" \  
 -D "$trace_results_dir/trace" \  
 -t "$tracetemplate" \  
 $bundle_dir \  
-e UIARESULTSPATH "$trace_results_dir" \  
-e UIASCRIPT "$automation_script" \  
-AppleLanguages "($language)" \  
-AppleLocale "$language" \  
$* ; do  
  echo Instruments failed to start up... retrying in 2 seconds  
  sleep 2  
done `    

Thanks to this post:
http://serverfault.com/questions/80862/bash-script-repeat-command-if-it-returns-an-error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants