RoutingHTTPServer not found build using xcodebuild - ios

Mac OS: 10.13.4
Xcode: 9.3
Appium: 1.7.2
I am unable to build WebDriverAgent and install WebDriverAgent using xcode. I've reinstalled Appium and the current user does have R/W permissions in the folder where the appium modules are installed. I've also followed the real device setup tutorial
2018-04-12 10:47:58.039414-0500 WebDriverAgentRunner-Runner[233:6835] Running tests...
2018-04-12 10:47:58.924245-0500 WebDriverAgentRunner-Runner[233:6835] The bundle “WebDriverAgentRunner” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2018-04-12 10:47:58.925176-0500 WebDriverAgentRunner-Runner[233:6835] (dlopen_preflight(/var/containers/Bundle/Application/D2529C60-100A-4A31-AD0D-C5F4A33920F2/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/WebDriverAgentRunner): Library not loaded: #rpath/RoutingHTTPServer.framework/RoutingHTTPServer
Referenced from: /private/var/containers/Bundle/Application/D2529C60-100A-4A31-AD0D-C5F4A33920F2/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework/WebDriverAgentLib
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/D2529C60-100A-4A31-AD0D-C5F4A33920F2/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework/Frameworks/RoutingHTTPServer.framework/RoutingHTTPServer: required code signature missing for '/private/var/containers/Bundle/Application/D2529C60-100A-4A31-AD0D-C5F4A33920F2/WebDriverAgentRunner-Runner.app/PlugIns/WebDriverAgentRunner.xctest/Frameworks/WebDriverAgentLib.framework/Frameworks/RoutingHTTPServer.framework/RoutingHTTPServer'
)
2018-04-12 10:47:59.008 xcodebuild[68163:1492596] Error Domain=IDETestOperationsObserverErrorDomain Code=6 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}
Testing failed:
Early unexpected exit, operation never finished bootstrapping - no restart will be attempted
** TEST FAILED **

Follow below step:
Go to your appium installed path and go node_modules/appium-xcuitest-driver/WebDriverAgent and run below command from WebDriverAgent:
bashbash Scripts/bootstrap.sh -d Scripts/bootstrap.sh -d
and then execute below command from same folder
mkdir -p /Resources/WebDriverAgent.bundle
This will solve your problem

To fix this issue link the RoutingHTTPServer.framework in xcode on the general tab in the section Linked Frameworks and Libraries. Look here to see where to do this in xcode
Also if you're running on simulators you'll have to use appium's 1.8 beta

Related

How to solve 'Test runner exited before starting test execution' error for iPhone Devices

Context -
We have E2E Testing running on the CI on the iPhone devices.
The script performs the following steps -
Build the Test runner app from code.
Extracts the app file from the IPA.
Re-codesign the app with the required Provision Profiles.
Creates a .xctestrun file
Uses the xcodebuild command like the following to run the test -
xcodebuild -sdk iphoneos -destination id=<device_id> -xctestrun <path_to_xctestrun_file> -resultBundlePath <path_to_test_bundle_file> test-without-building -only-testing:E2ETestsBundle.xctest/<test_filter>
The above command installs the runner and target app into the device and starts executing the test.
The apps get installed and uninstalled at each run during a single execution.
Problem -
During the execution, the xcodebuild CLI tool, suddenly loses connection to the device and is not able to install the apps into the device and then results in the following error -
Testing failed:
E2ETestsBundle.xctest:
E2ETestsBundle-Runner encountered an error (Early unexpected exit, operation never finished bootstrapping - no restart will be attempted. (Underlying Error: Test runner exited before starting test execution. If you believe this error represents a bug, please attach the log file at /var/folders/1r/0xlnbmzd0yj3m_cc7p95yb4r0000gn/T/tmpl7d9p1s6/testResults.bundle/Staging/1_Test/Diagnostics/E2ETestsBundle-Configuration-Test Scheme Action-Iteration-1/E2ETestsBundle/Session-E2ETestsBundle-2022-04-13_205520-muaMCx.log))
** TEST EXECUTE FAILED **
Points to note -
The xcodebuild CLI tool will keep on failing with the error once it occurred until recovered.
Even while the xcodebuild is in a failed state, the devices are still accessible via Xcode IDE and other CLI tools like libimobiledevice and are able to install both the test runner and target applications.
This is occurring intermittently across all devices models and across subversions of iOS 14 and 15.
Recovery -
The only way to recover is to reboot the device.
Even after a reboot, the devices start facing this exception again after a few days of execution.
As we can’t keep on rebooting the device every time before execution, we need a solution to fix this problem.
Any help would be appreciated!!

Couldn’t be opened because you don’t have permission to view it - React Native - Expo?

After ejecting the Expo project using expo eject, and try to run the project using Xcode "11.7" & Command-line "For iOS"
I got these errors,
Note:
Android Works well after ejecting
iOS & Android Works well before Ejecting.
Xcode
Details
The file “MyApp” couldn’t be opened because you don’t have permission to view it.
Domain: NSCocoaErrorDomain
Code: 257
Failure Reason: You don’t have permission.
Recovery Suggestion: To view or change permissions, select the item in the Finder and choose File > Get Info.
User Info: {
NSFilePath = "/Users/username/Library/Developer/Xcode/DerivedData/MyApp-bnfffrwsrhskljawuujrmpuwldgt/Build/Products/Debug-iphonesimulator/MyApp.app";
}
--
The operation couldn’t be completed. Permission denied
Domain: NSPOSIXErrorDomain
Code: 13
Failure Reason: Permission denied
--
System Information
macOS Version 10.14.6 (Build 18G95)
Xcode 11.7 (16142)
Architectures
Command-line
npx react-native run-ios
info Found Xcode workspace "MyApp.xcworkspace"
info Launching iPhone 11 (iOS 13.7)
info Building (using "xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=60F7E669-0AE4-4CF3-9BC8-17027D01B172")
success Successfully built the app
info Installing "/Users/username/Library/Developer/Xcode/DerivedData/MyApp-bnfffrwsrhskljawuujrmpuwldgt/Build/Products/Debug-iphonesimulator/MyApp.app"
An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Could not install at this time.
Failed to chmod /Users/username/Library/Developer/CoreSimulator/Devices/60F7E669-0AE4-4CF3-9BC8-17027D01B172/data/Bundle/Application/3C7513F0-9BFE-4C94-A722-7C1BE6898E54/MyApp.app/MyApp : No such file or directory
Underlying error (domain=MIInstallerErrorDomain, code=4):
Failed to chmod /Users/username/Library/Developer/CoreSimulator/Devices/60F7E669-0AE4-4CF3-9BC8-17027D01B172/data/Bundle/Application/3C7513F0-9BFE-4C94-A722-7C1BE6898E54/MyApp.app/MyApp : No such file or directory
info Launching "com.MyApp"
error Failed to launch the app on simulator, An error was encountered processing the command (domain=FBSOpenApplicationServiceErrorDomain, code=1):
The request to open "com.MyApp" failed.
The request was denied by service delegate (SBMainWorkspace) for reason: NotFound ("Application "com.MyApp" is unknown to FrontBoard").
Underlying error (domain=FBSOpenApplicationErrorDomain, code=4):
The operation couldn’t be completed. Application "com.MyApp" is unknown to FrontBoard.
Application "com.MyApp" is unknown to FrontBoard.
Failure Reason: You don’t have permission.
First of all please be sure that delete the derived data
If it didn't work then change permission for Terminal. Detail link is here
Probably you would not need this but just in case :
Maybe disabling system integrity protection with csrutil disable works for you.
Highly recommend you to read the Apple document first.
I also had this problem when I used react-native to create a new project.I had solved this problem.
System Information
macOS Version 10.14.4
Xcode 11.3.1 (16142)
run "react-native --version" in project directory. The version is "react-native: 0.64.0". I used "npx react-native init interview --version 0.63.4" to create a new project.It worked!
So I guess use the older version to create a new project can solve your problem.

react-native run-ios keeps on failing

after updating MacOS to Big Sur and since Legacy build is deprecated
react-native run-ios does not work anymore, I've tried so many solutions but no progress I've been suffering with this for around 3 days.
side note that build on xcode succeeded
versions:
react-native: 0.59.10
xcode: 12
and I'm using iPhone 11 simulator and I also tried a real iPhone 11 device
result of npx react-native run-ios
on simulator:
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening myapp.xcworkspace
** BUILD FAILED **
The following build commands failed:
Ld /myapp/ios/build/Build/Products/Debug-iphonesimulator/myapp.app/PlugIns/myapp.xctest/myapp normal
(1 failure)
another one on the simulator:
info ** BUILD SUCCEEDED **
info Installing DerivedData/Build/Products/Debug-iphonesimulator/myapp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/myapp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
on device:
info ** BUILD SUCCEEDED **
info installing and launching your app on Menna’s iPhone...
info ** INSTALLATION SUCCEEDED **
but the application doesn't appear on the device and I don't know how is that even possible?!
any help would be appreciated
SOLVED
in xcode, go to Project Settings > change build system to new build system
click on Advanced, then choose Custom (Relative to workspace) and specify locations as following:
Products: build/Build/Products
Intermediates: build/Build/Intermediates.noindex
in vs code, open node_modules/#react-native-community/cli/build/commands/runIOS/runIOS.js
and change DerivedData/Build/Products/${configuration}-${device}/${appName}.app
to build/Build/Products/${configuration}-${device}/${appName}.app;
delete ios/build and DerivedData content
run react-native run-ios again
try:
sudo npm install -g ios-deploy --unsafe-perm
and next:
yarn ios --device "YOUR_DEVICE_NAME"

Xcode 10 Buildscript not running anymore

I have a Buildscript integrated in my build settings. With Xcode 9 it was running smoothly. But since XCode 10 its not running anymore and gives me the following error:
error: unable to attach DB: error: accessing build database ".../build/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.
I already tried the solution which I found here:
Xcode 10: unable to attach DB error
But this didnt help me. Still having the issue...
UPDATE: If I switch to "Legacy Build Settings" I get this error:
Prepare build
note: Using legacy build system
Build Preparation
Couldn't update module cache session file'/var/folders/xh/zc0g0hp13j982ws3qhlr09nm0000gn/C/com.apple.DeveloperTools/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/10.0-10A255/Xcode/ModuleCache.noindex/Session.modulevalidation': The item couldn’t be saved because the file name “Session.modulevalidation” is invalid.
** BUILD FAILED **
Command /bin/sh failed with exit code 65

react-native run-ios: The bundle identifier of the application could not be determined

I am playing with React-Native and trying to build a Hello-world app, however, I am still unable to run the app. If I run react-native run-ios, I get this error:
...
Build system information
unexpected service error: The Xcode build system has crashed. Please close and reopen your workspace.
Build system information
error: unexpected service error: The Xcode build system has crashed. Please close and reopen your workspace.
** BUILD FAILED **
The following commands produced analyzer issues:
Analyze /Users/adam/react-native_dev/JustATributeApp/node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
(1 command with analyzer issues)
The following build commands failed:
Analyze /Users/adam/react-native_dev/JustATributeApp/node_modules/react-native/Libraries/Text/RCTTextAttributes.m normal x86_64
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/JustATributeApp.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/JustATributeApp.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
I found quite a few topics with this error, but none of them led to solving it.
Here is some additional information:
react-native-cli: 2.0.1
react-native: 0.56.0
xcode 10.0 beta 2 (10L177m)
How do I debug/fix this issue?
Thank you
The key piece of the error message is Ensure that the application's Info.plist contains a value for CFBundleIdentifier. Here's how we can fix that.
Open yourprojectname.xcodeproj in Xcode, and check the bundle identifier under the 'General' tab. It should have a value. Mine is com.yourprojectname.app.ios.triplets . If that field is blank, set the bundle identifier to something. Modifying this field will make the changes to your info.plist.
I suggest restarting React.
To do so, just run the following commands:
# Kill current processes
killall node -9
# Start React - Native
react-native start
# Run android
react-native run-android or react-native run-ios
That should do the trick.

Resources