Setting up mobile automation project in macOS - Build Failed

Hi All,

Doing step by step with this tutorial :

https://www.katalon.com/resources-center/tutorials/set-up-mobile-automation-project-macos/

when doing this step :

  • Select WebDriverAgentLib, and in the Signing section, check Automatically manage signing and select a team.

and Got an error :

CodeSign /Users/admin/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/Frameworks/YYCache.framework
cd /usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity: “XXXXXX”

/usr/bin/codesign --force --sign xxxxxxxxxx --preserve-metadata=identifier,entitlements,flags --timestamp=none /Users/admin/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/Frameworks/YYCache.framework  

/Users/admin/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/Frameworks/YYCache.framework: replacing existing signature
/Users/admin/Library/Developer/Xcode/DerivedData/WebDriverAgent-brdadhpuduowllgivnnvuygpwhzy/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/Frameworks/YYCache.framework: errSecInternalComponent
Command /usr/bin/codesign failed with exit code 1

i use iOS version 11.4.1

xcode version 9.4.1

Can anyone help me?

Hi Fransiscus,

My first guess is that something is wrong with the framework dependencies installed by Carthage (YYCache is one of those).

For some reason, when you install Appium on MacOS, the WebDriverAgent/Carthage directory - where the project dependencies are stored - is actually a file, not a directory.

You can confirm if this is the case by looking at the Carthage file’s properties in your WebDriverAgent folder.

First, go to the folder where the WebDriverAgent code is installed. Probably in your case:

/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent

Then look at what type of file “Carthage” is:

ls -l Carthage

If the output doesn’t start with a “d”, then it’s just a file.

Correct:

drwxr-xr-x

Incorrect

-rwxr-xr-x

To fix this, in your WebDriverAgent folder, remove the Carthage file:

rm Carthage

Then create a directory correctly:

mkdir Carthage

Finally, try running the bootstrap.sh command again:

./Scripts/bootstrap.sh -d

Hope this helps!

Hi Chris,

Thanks before for your help.

I try and follow your steps, is this correct?

Screen Shot 2018-08-27 at 10.29.58.png

Hi Fransiscus, that does look right.

In XCode, when you set the “Automatically manage signing” for WebDriverAgentLib, do you see any errors on that screen (anything in red?) Can you check the same thing for WebDriverAgentRunner? You should also choose “Automatically manage signing” for WebDriverAgentRunner. Do you see anything in red when you do that?

- Chris

Hi Chris,

When open XCode and try to build found this :

Is That errors you mean?

Screen Shot 2018-08-27 at 11.51.41.png

Screen Shot 2018-08-27 at 11.49.48.png

Hi Fransiscus,

I’m not that concerned about the red in the file navigator at this point (usually that means that the file isn’t where the Xcode project thinks it is, but I don’t think it should affect code signing).

Could you please click the dropdown for “WebDriverAgentLib” near the top of the screen (in the same row as General, Resource Tags, etc.)?

Choose “WebDriverAgentRunner” and see if there are any red errors near the middle of the screen in the “Signing” section.

You’ll want to do the same thing you did before to set “Automatically manage signing” and select your Team and Signing Certificate.

If you’re still seeing errors then, please include a screenshot of that WebDriverAgentRunner page, too.

Thanks,

Chris

Hi Chris,

Is this what you mean?

Already Select Team and Signing Certificate.

Automatically signing running well, but when build, WebDriverAgentLib build failed.

Screen Shot 2018-08-27 at 11.52.23.png

Yes, that was the screen I wanted to see. At first glance, that looks right.

Can you tell me:

  1. What type of certificate is the signing certificate? Is it “iPhone Developer” or “Distribution”?
  2. If you click the “Code sign error” message, do you see more info? Is that what you pasted in your original message or is there more?
  1. I use iPhone Developer signing certificate

  2. i already paste to you the code sign error.

i already talked to my iOS developer about this problem, maybe from the certificate or not. After discussion and track the error it’s not from certificate.

When i Select Team as “none”, build success.

Screen Shot 2018-08-28 at 11.26.40.png

That is interesting. So can you set the WebDriverAgentLib signing to “None” and the WebDriverAgentRunner signing to “Automatically manage signing”? The Runner is supposed to build, copy, and sign the Lib anyway when it builds, so I don’t think you need to build the WebDriverAgentLib alone, just the WebDriverAgentRunner.

If that doesn’t work, it looks like there are a bunch of other possible solutions to this signing issue that you could try: https://stackoverflow.com/questions/2017756/command-usr-bin-codesign-failed-with-exit-code-1

- Chris

Yes, i can build with WebDriverAgentLib set “None” and WebDriverAgentRunner “Automatically” but always error when open record mobile or spy mobile. Then i try find solution by googling it, i try every steps but never success. I came to this forum find solution. Maybe should i uninstall katalon and clean all data then install and set up new one?

Ah, so if you’re getting an error when trying to record mobile or spy, that might be something different. Can you share the error is when trying to do the spy mobile?

The Problem are :

1. When build WebDriverAgent, already automatically signing and set Team both WebDriverAgentLib and WebDriverAgentRunner were failed with error **Command /usr/bin/codesign failed with exit code 1
**

2. It can build WebDriverAgentLib with select Team “None” and WebDriverAgentRunner automatically signing.

both of them when open Katalon studio and spy mobile show this error:

Screen Shot 2018-08-30 at 11.18.02.png

Hi,
Have you tried this: npm install -g appium@1.8.1
http://forum.katalon.com/discussion/4258/i-cant-spy-or-record-on-android-mobile#latest

Hi Fransiscus,

Is that latest error with ios-deploy happening when you try to Spy Mobile on a real device? If so, are you giving it an .app file or an .ipa file?

You will need to provide a code signed .ipa file of the iOS app to run on a real device (similar to how you signed the WebDriverAgentRunner).

If you don’t have a signed .ipa file, can you try running Spy Mobile on a simulator with the .app file?

- Chris

Ctof said:

Hi,
Have you tried this: npm install -g appium@1.8.1
http://forum.katalon.com/discussion/4258/i-cant-spy-or-record-on-android-mobile#latest

Hi Ctof, thank you for your support. I already use appium 1.8.1

Hi Chris,

That is after i build WebDriverAgentLib and WebDriverAgentRunner i use .ipa file

Is that error related with error build WebDriverAgent?

Hi Fransiscus,

I’ve had problems running Katalon tests with an .ipa file in a simulator, and I believe it’s because most of the time, an .ipa file is created for the real device architectures (arm7 arm64) and not the simulator architectures (i386 x86_64).

To check what your .ipa is built for, you can do the following:

- Change the .ipa extension to .zip (allow when prompted)
- Extract the .zip
- In a Terminal, navigate to the extracted Payload directory
- In the Terminal, enter:

lipo -info MyApp.app/MyApp

Where “MyApp” is the name of your app. You should see a list of the architectures in the file.

If the architectures are arm7 and arm64, you won’t be able to use that .ipa in a simulator, including Mobile Spy or Test Recorder.

To get around this, I have been using the .app built by Xcode instead. This is an unsigned application and works much better on simulators. You can find the .app file in your “DerivedData/MyApp/Build/Products/Development-iphonesimulator” directory.

Hope this helps,

Chris

Hi Chris,

So, first of all i need to check what my .ipa file built for?

Okay, i will try your steps. Thanks for your help

Could you please here. Having too much hope from you.

I am not able to spy my attached iOS device in Katalon.Everything is configured properly but at last step when I try to spy the elements on screen i couldn’t it just highlighting main screen.I couldn’t locate any of the component on the screen.

Waiting for reply…!!

Hi @perry.g,

Does the it work on a simulator (is it only a real device that has the issue)?

Could you please share a screenshot or video of what you’re seeing? Specifically, I’m looking for what you’re seeing in the Spy Mobile preview window and what’s showing in the “All Objects” window.