8

I am using Xcode Beta 14, tring to build WebDriverAgent

getting below errors

WebDriverAgent/Build/Products/Debug-iphoneos/WebDriverAgentLib.framework/WebDriverAgentLib

ld: cannot link directly with dylib/framework, your binary is not an allowed client of /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

note: Using codesigning identity override: iPhone Developer note: Building targets in dependency order ** TEST BUILD FAILED **

any issue with Beta or any further preferences required to set it up.

enter image description here

Solid Soft
  • 1,872
  • 2
  • 25
  • 55

12 Answers12

4

I’m using

  • Xamarin.iOS
  • Visual Studio for Mac 17.4 with enabled manual provisioning
  • Xcode 14.1
  • macOS Monterey 12.6.1

and I experienced the same error listed in the author’s question. Here are the steps which helped me to fix the issue:

  1. Install the latest Appium Desktop as described here.

  2. Install the latest appium-doctor:

    npm install -g appium-doctor
    
  3. Make sure that appium-doctor shows green status for all necessary dependencies:

    appium-doctor --ios
    

    enter image description here

  4. Install latest WebDriverAgent:

    npm install -g appium-webdriveragent
    
  5. Navigate to the WebDriverAgent folder:

    cd /opt/homebrew/lib/node_modules/appium-webdriveragent
    
  6. As described in the documentation, start WebDriverAgent via xcodebuild with supplied platform and name:

    xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 7 Plus' test
    

    Note: when I tried to start WebDriverAgent from its folder inside of the Appium Desktop or appium npm package, then I was getting the error message from the author's question.

  7. Deploy the test application to the ios simulator, for example via Visual Studio.

  8. Start Appium Desktop server.

  9. Run the simple test from the console app with Appium.WebDriver NuGet installed:

    static void Main(string[] args)
    {
        var o = new AppiumOptions();
    
        o.AddAdditionalCapability(MobileCapabilityType.NoReset, "true");
        o.AddAdditionalCapability(MobileCapabilityType.AutomationName, "XCUITest");
        o.AddAdditionalCapability(MobileCapabilityType.PlatformName, "iOS");
        o.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "13.1");
        o.AddAdditionalCapability(MobileCapabilityType.DeviceName, "iPhone 7 Plus");
    
        // set app file path which can be found at the loction like:
        // /Users/myusername/Library/Developer/CoreSimulator/Devices/someid1/data/Containers/Bundle/Application/someid2/appname.app"
        // you can pick up this path from application output in visual studio as well
        o.AddAdditionalCapability(MobileCapabilityType.App, "path to .app file");
    
       var driver = new IOSDriver<IOSElement>(new Uri("http://127.0.0.1/wd/hub"), o);
    
       driver.FindElementByAccessibilityId("testid").Click();
    }
    

And that's it. Hope this might help someone.

r23
  • 293
  • 6
  • 12
3

The issue has been fixed on my side please follow below steps

  1. Go to Application folder where Appium Server GUI Installed right click on it then show package contents -> contents -> Resources -> app -> node modules -> appium -> node modules -> (inside node modules go to appium-webdriveragent) now download WebDriverAgent from below link and replace everything except build and paste it
  2. Now Relaunch WebdriverAgent Project from xcode and add apple account and signin by providing team and bundleidentifier in WebDriverAgentLib, WebdriverAgentRunner and IntegrationApp.
  3. From top select WebDriverAgentRunner and build the project once project build is successfull you will not find that
1

Starting with Xcode 14 XCTAutomationSupport and other private frameworks have an allowlist of libraries that can link with them. The list is specified with the LC_SUB_CLIENT load commands. You can see who is allowed to link using: otool -l XCTAutomationSupport | grep -A 2 LC_SUB_CLIENT.

One way I found to bypass this restriction is to:

  1. Create a fake library with an allowed name
  2. When linking the fake library, specify that it should reexport XCTAutomationSupport: -reexport_framework XCTAutomationSupport
  3. Link the image that requires XCTAutomationSupport with your fake library instead of linking it with XCTAutomationSupport

Here is an example showing how you can set this up in Xcode.

Timofey Solonin
  • 1,393
  • 13
  • 20
  • I am getting error to get list, mac@static-251 % otool -l XCTAutomationSupport | grep -A 2 LC_SUB_CLIENT error: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool-classic: can't open file: XCTAutomationSupport (No such file or directory) – Solid Soft Sep 13 '22 at 06:34
  • Try like this: `otool -l "$(xcrun --sdk iphonesimulator --show-sdk-platform-path)"/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport | grep -A 2 LC_SUB_CLIENT` – Timofey Solonin Sep 13 '22 at 07:34
  • Can you help me with step by step to process it? – Solid Soft Sep 22 '22 at 13:18
  • For anyone wondering how this is done, there's an ld flag `-allowable_client` now – ReinstateMonica3167040 Feb 25 '23 at 16:09
1

Had the same issue because of Xcode update to 14.0

So if you don't need to work on 14.0 ver, simply downgrade your Xcode to 13.4 (or such) version and it should work.

You can download it from apple developers page

Hope this helps!

1

Getting the same error with:

Appium desktop version: 1.22.3

Xcode:14.1

iOS:16.1.2

MacOs:12.6.1

Step1:

npm install -g appium@next

This installed the appium version: 2.0.0-beta.46

Step2: Then install the driver for xcuitest:

appium driver install xcuitest

if you get issues like below in running above command: STDOUT:

STDERR:

npm ERR! code ERESOLVE

npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR!

npm ERR! While resolving: undefined@undefined

npm ERR! Found: appium@1.22.3

npm ERR! node_modules/appium

npm ERR! appium@”^1.22.1″ from the root project

Solution is:

  • Remove desktop Appium of above mentioned version
  • Navigate to users/userName directory and delete the following folder and files

-- /node_modules/

-- package.json

-- package.lock.json

These above files refer to earlier appium installation.

then try to run command to install appium drivers, you should be good now!

Step 3: Go to the folder:

/Users/${your_user}/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent

Run this command for Real device:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id='{device_id}' test -allowProvisioningUpdates

Run this command for Simulator:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination name='{device_name}' test -allowProvisioningUpdates
1

XCode 14.1 error with WDA Solution for appium installed via node i.e.

npm -g install appium

Crux of problem is WDA version which needs to be 4.9.0 As we installed appium using node, we need to update package.json to get 4.9.0 WDA

Dependency chain is

appium -> appium-xcuitest-driver -> appium-webdriveragent

We need to update appium-xcuitest-driver version at package.json of appium I figure out perfect version for this is 4.12.0

Steps to resolve this issue is

  1. cd #appiumNodeDirectory#
  2. open pacakge.json inside appium directory
  3. Search for "appium-xcuitest-driver"
  4. Replace with "appium-xcuitest-driver": "4.12.0" (updated to 4.12.0)
  5. save file and quit webdriveragent xcode project if it is open
  6. npm install (make sure you are at appium folder)
  7. Open WDA in Xcode 14.1 and code sign

Now you may use Xcode 14.1 and ios 16 devices with your appium installed with node

positivecrux
  • 1,307
  • 2
  • 16
  • 35
0

@Solid Soft You should give full path like: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/XCTAutomationSupport.framework/XCTAutomationSupport

  • framework added in frameworks and libraries, I am just updating my question. – Solid Soft Sep 13 '22 at 07:15
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Vikram Parimi Sep 16 '22 at 12:39
0

Answer of VincentYao here works for me

We need to update WebDriverAgent to v4.9.0

Huy Hóm Hỉnh
  • 597
  • 7
  • 18
0

This is fixed using latest WebDriverAgent 4.10.2 (npm install -g appium@latest). However, if you installed appium via node, the appium version is just 1.22.3 and it's not included the latest WDA. I suggest to download the WDA from the website (https://github.com/appium/WebDriverAgent/releases) and install it on your device then using the capability "usePrebuiltWDA" = true to bypass this.

Hien Phan
  • 21
  • 2
0

I had the same issue and solved by downgrading Xcode from 14.1 to 13.4.1

Unfortunately Appium2 (2.0.0-beta.46) didn't work on my framework (Katalon Studio), so I'm still working with appium 1.22.3

0

Getting the same error with:

Appium desktop version: 1.22.3

Xcode:14.1

iOS:16.1.2

MacOs:12.6.1

Steps to fix the issue:

npm install -g appium@next

This installed the appium version: 2.0.0-beta.46

Then install the driver for xcuitest:

appium driver install xcuitest

Go to the folder:

/Users/${your_user}/.appium/node_modules/appium-xcuitest-driver/node_modules/appium-webdriveragent

Open WebDriverAgent.xcodeproj with xCode and sign it.

Then run the command:

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id='{device_id}' test -allowProvisioningUpdates
Julian Mesa
  • 379
  • 3
  • 4
0

Here is what worked for me:

cd /usr/local/lib/node_modules/appium-webdriveragent.

xcodebuild -project WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination 'platform=iOS Simulator,name=iPhone 13’  test
desertnaut
  • 57,590
  • 26
  • 140
  • 166