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

fix(tvOS): Replace ios-deploy with xcrun commands in @react-native-community/cli-platfom-ios #1759

Merged
merged 7 commits into from
Nov 8, 2024

Conversation

RicardasN
Copy link
Collaborator

@RicardasN RicardasN commented Oct 17, 2024

Description

Removed the previous solution for this from runner.tsx and replaced it with an override of the @react-native-community/cli-platform-ios plugin.
The key issue is - ios-control/ios-deploy#588, however, unlike before ios-control/ios-deploy#588 Apple no longer features versioned device support directories https://developer.apple.com/forums/thread/730947, hence the failure with launching the apps on tvOS.

Why override the plugin instead of building the app inside the runner and install it via xcrun? Fast refresh. I noticed, that if I do so, it no longer works, which would hamper development, therefore the better solution in this case is to have slightly worse maintainability, but fast refresh working.

Related issues

Testing

I tested 2 scenarios - tvOS install and launch via cable and via network, both cases seem to work fine, but this needs to be tested wth iOS devices (I have none available to me) to make sure it did not affect them in any negative way.

Extra to discuss

This change would mean, that anyone running latest renative (using 12.3.6 of @react-native-community/cli) needs to have Xcode 15 or newer installed, otherwise there will be issues installing the app too on tvOS, not just launching it, where should that be documented?

@RicardasN RicardasN added the e2e label Oct 17, 2024
@GabrieleKaceviciute
Copy link
Collaborator

when I try to run on ios device, I get this error ->
error.txt

Xcode version 15.2
OS: macOS M2 pro, Ventura 13.6.4
Node version 18.19.0

@RicardasN
Copy link
Collaborator Author

when I try to run on ios device, I get this error -> error.txt

Xcode version 15.2 OS: macOS M2 pro, Ventura 13.6.4 Node version 18.19.0

It seems to say device not found, could you check if it's displayed in Xcode amongst selection of devices before running? Asking only because e2e seems to have worked.

@GabrieleKaceviciute
Copy link
Collaborator

Device is displayed in xcode. e2e didn't test it on device. On simulator it works for me too.

Screenshot 2024-10-18 at 12 25 49

@RicardasN
Copy link
Collaborator Author

RicardasN commented Oct 18, 2024

Device is displayed in xcode. e2e didn't test it on device. On simulator it works for me too.

Screenshot 2024-10-18 at 12 25 49

Which XCode are you running? I see mentions on Apple forums on similar issues fixed in xcode 15.1 - https://forums.developer.apple.com/forums/thread/737286

In another thread I see

EDIT: Removing app from device and reinstalling helped.

Sorry for pinging you about this constantly, but I don't have an iOS device to test

@GabrieleKaceviciute
Copy link
Collaborator

Which XCode are you running?

Xcode version 15.2

Removing app from device and reinstalling helped.

There is no rnv app on ios device.

@pauliusguzas
Copy link
Collaborator

pauliusguzas commented Oct 18, 2024

- Building the app........
- Building the app.........
- Building the app
- Building the app.
- Building the app......
- Building the app.......
- Building the app...
- Building the app......
success Successfully built the app
2024-10-18 13:55:43.890 xcodebuild[56580:567714] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition
info Installing and launching your app on ReactSeals’s iPad
info xcrun devicectl device install app --device 591253557404a06ec4a7ce4fc091c84bdcd76442 /Users/pauliusguzas/Library/Developer/Xcode/DerivedData/RNVApp-gjzjepxhdyzjragduoajenydfimw/Build/Products/Debug-iphoneos/RNVApp.app
info Launching your app on ReactSeals’s iPad
info xcrun devicectl device process launch --device 591253557404a06ec4a7ce4fc091c84bdcd76442 {"st
ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000.)
error Failed to install the app on the device. We've encountered an error: ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000.).


│ Project location: ./platformBuilds/template_ios/RNVApp.xcworkspace
└─────────────────────────────────────────────────────────────────┘
error: ⨯ ○ run: COMMAND:

node /Users/pauliusguzas/Desktop/renative/renative/node_modules/react-native/local-cli/cli.js start --port 8082 --no-interactive --config=metro.config.js --reset-cache

FAILED with ERROR:

Error: Command was killed with SIGTERM (Termination): node /Users/pauliusguzas/Desktop/renative/renative/node_modules/react-native/local-cli/cli.js start --port 8082 --no-interactive --config=metro.config.js --reset-cache
    at makeError (/Users/pauliusguzas/Desktop/renative/renative/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/pauliusguzas/Desktop/renative/renative/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)


pauliusguzas@MBP-de-Flexn template-starter %

this is the error I am getting while installing on ipad, xcode 15.2

@RicardasN
Copy link
Collaborator Author

- Building the app........
- Building the app.........
- Building the app
- Building the app.
- Building the app......
- Building the app.......
- Building the app...
- Building the app......
success Successfully built the app
2024-10-18 13:55:43.890 xcodebuild[56580:567714] Requested but did not find extension point with identifier Xcode.InterfaceBuilderBuildSupport.PlatformDefinition
info Installing and launching your app on ReactSeals’s iPad
info xcrun devicectl device install app --device 591253557404a06ec4a7ce4fc091c84bdcd76442 /Users/pauliusguzas/Library/Developer/Xcode/DerivedData/RNVApp-gjzjepxhdyzjragduoajenydfimw/Build/Products/Debug-iphoneos/RNVApp.app
info Launching your app on ReactSeals’s iPad
info xcrun devicectl device process launch --device 591253557404a06ec4a7ce4fc091c84bdcd76442 {"st
ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000.)
error Failed to install the app on the device. We've encountered an error: ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000.).


│ Project location: ./platformBuilds/template_ios/RNVApp.xcworkspace
└─────────────────────────────────────────────────────────────────┘
error: ⨯ ○ run: COMMAND:

node /Users/pauliusguzas/Desktop/renative/renative/node_modules/react-native/local-cli/cli.js start --port 8082 --no-interactive --config=metro.config.js --reset-cache

FAILED with ERROR:

Error: Command was killed with SIGTERM (Termination): node /Users/pauliusguzas/Desktop/renative/renative/node_modules/react-native/local-cli/cli.js start --port 8082 --no-interactive --config=metro.config.js --reset-cache
    at makeError (/Users/pauliusguzas/Desktop/renative/renative/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/pauliusguzas/Desktop/renative/renative/node_modules/execa/index.js:118:26)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)


pauliusguzas@MBP-de-Flexn template-starter %

this is the error I am getting while installing on ipad, xcode 15.2

Hmm, very interesting, it seems to have a problem with launching the app, because the output is very weird of that second info. Could you check what you get if you run the first command:

xcrun devicectl device install app --device 591253557404a06ec4a7ce4fc091c84bdcd76442 /Users/pauliusguzas/Library/Developer/Xcode/DerivedData/RNVApp-gjzjepxhdyzjragduoajenydfimw/Build/Products/Debug-iphoneos/RNVApp.app

Because it seems the output of that is a weird string, that might be different for iOS compared to tvOS

@pauliusguzas
Copy link
Collaborator

pauliusguzas@MBP-de-Flexn template-starter % xcrun devicectl device install app --device 591253557404a06ec4a7ce4fc091c84bdcd76442 /Users/pauliusguzas/Library/Developer/Xcode/DerivedData/RNVApp-gjzjepxhdyzjragduoajenydfimw/Build/Products/Debug-iphoneos/RNVApp.app
ERROR: The specified device was not found. (com.apple.dt.CoreDeviceError error 1000.)
pauliusguzas@MBP-de-Flexn template-starter %

@Marius456 Marius456 added this to the 1.5 milestone Oct 21, 2024
@Marius456 Marius456 modified the milestones: 1.5, 1.6 Oct 22, 2024
@Marius456 Marius456 marked this pull request as draft October 23, 2024 07:04
@GabrieleKaceviciute
Copy link
Collaborator

GabrieleKaceviciute commented Oct 28, 2024

  • Install app on iOS via CLI -> error (see previous comment)
  • iOS via xCode -> app installed and launched
  • tvOS via CLI -> app installed but not launched
  • tvOS via xCode v15.2 -> connected device is not found
  • tvOS via xCode v16.0 -> app installed but not launched, this error appears ->
The request to open "renative.helloworld.debug" failed.
Domain: IDELaunchCoreDevice
Code: 0
User Info: {
    DVTErrorCreationDateKey = "2024-10-28 13:59:04 +0000";
    IDERunOperationFailingWorker = IDELaunchCoreDeviceWorker;
}
--
The application failed to launch.
Domain: com.apple.dt.CoreDeviceError
Code: 10002
User Info: {
    BundleIdentifier = "renative.helloworld.debug";
}
--
The request to open "renative.helloworld.debug" failed.
Domain: FBSOpenApplicationServiceErrorDomain
Code: 1
Failure Reason: The request was denied by service delegate (PBProcessManager) for reason: NotFound ("Cound not find any application for open app system request <FBSystemServiceOpenApplicationRequest: 0x303b6f540; trusted: YES; bundleID: renative.helloworld.debug; client: anon<dtappserviced>:6732>").
User Info: {
    BSErrorCodeDescription = RequestDenied;
    FBSOpenApplicationRequestID = 0x69b3;
}
--
The operation couldn't be completed. Cound not find any application for open app system request <FBSystemServiceOpenApplicationRequest: 0x303b6f540; trusted: YES; bundleID: renative.helloworld.debug; client: anon<dtappserviced>:6732>
Domain: FBSOpenApplicationErrorDomain
Code: 4
Failure Reason: Cound not find any application for open app system request <FBSystemServiceOpenApplicationRequest: 0x303b6f540; trusted: YES; bundleID: renative.helloworld.debug; client: anon<dtappserviced>:6732>
User Info: {
    BSErrorCodeDescription = NotFound;
}
--

Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
    "device_identifier" = addfcc35fc6fd800c67ce1ff49e48a85c206a474;
    "device_isCoreDevice" = 1;
    "device_model" = "AppleTV5,3";
    "device_osBuild" = "18.0 (22J357)";
    "device_platform" = "com.apple.platform.appletvos";
    "device_thinningType" = "AppleTV5,3";
    "dvt_coredevice_version" = "397.21";
    "dvt_coresimulator_version" = 987;
    "dvt_mobiledevice_version" = "1759.2.1";
    "launchSession_schemeCommand" = Run;
    "launchSession_state" = 1;
    "launchSession_targetArch" = arm64;
    "operation_duration_ms" = 13987;
    "operation_errorCode" = 0;
    "operation_errorDomain" = IDELaunchCoreDevice;
    "operation_errorWorker" = IDELaunchCoreDeviceWorker;
    "operation_name" = IDERunOperationWorkerGroup;
    "param_debugger_attachToExtensions" = 0;
    "param_debugger_attachToXPC" = 1;
    "param_debugger_type" = 3;
    "param_destination_isProxy" = 0;
    "param_destination_platform" = "com.apple.platform.appletvos";
    "param_diag_113575882_enable" = 0;
    "param_diag_MainThreadChecker_stopOnIssue" = 0;
    "param_diag_MallocStackLogging_enableDuringAttach" = 0;
    "param_diag_MallocStackLogging_enableForXPC" = 1;
    "param_diag_allowLocationSimulation" = 1;
    "param_diag_checker_tpc_enable" = 1;
    "param_diag_gpu_frameCapture_enable" = 0;
    "param_diag_gpu_shaderValidation_enable" = 0;
    "param_diag_gpu_validation_enable" = 0;
    "param_diag_guardMalloc_enable" = 0;
    "param_diag_memoryGraphOnResourceException" = 0;
    "param_diag_mtc_enable" = 1;
    "param_diag_queueDebugging_enable" = 1;
    "param_diag_runtimeProfile_generate" = 0;
    "param_diag_sanitizer_asan_enable" = 0;
    "param_diag_sanitizer_tsan_enable" = 0;
    "param_diag_sanitizer_tsan_stopOnIssue" = 0;
    "param_diag_sanitizer_ubsan_enable" = 0;
    "param_diag_sanitizer_ubsan_stopOnIssue" = 0;
    "param_diag_showNonLocalizedStrings" = 0;
    "param_diag_viewDebugging_enabled" = 1;
    "param_diag_viewDebugging_insertDylibOnLaunch" = 1;
    "param_install_style" = 2;
    "param_launcher_UID" = 2;
    "param_launcher_allowDeviceSensorReplayData" = 0;
    "param_launcher_kind" = 0;
    "param_launcher_style" = 99;
    "param_launcher_substyle" = 0;
    "param_runnable_appExtensionHostRunMode" = 0;
    "param_runnable_productType" = "com.apple.product-type.application";
    "param_structuredConsoleMode" = 1;
    "param_testing_launchedForTesting" = 0;
    "param_testing_suppressSimulatorApp" = 0;
    "param_testing_usingCLI" = 0;
    "sdk_canonicalName" = "appletvos18.0";
    "sdk_osVersion" = "18.0";
    "sdk_variant" = appletvos;
}
--


System Information

macOS Version 15.0.1 (Build 24A348)
Xcode 16.0 (23051) (Build 16A242d)
Timestamp: 2024-10-28T15:59:04+02:00

@GabrieleKaceviciute
Copy link
Collaborator

I've tested on iOS device -> both via xCode (v16.0) and via CLI app successfully installed and launched.
Need to check tvOS device.

@RicardasN RicardasN marked this pull request as ready for review October 31, 2024 08:50
@pauliusguzas
Copy link
Collaborator

ios works, tvos both cable and wireless installs but isn't launched when there is no app before

Copy link
Contributor

@ElenaDiachenko ElenaDiachenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything is fine, but I don't like this warning when I run the command the second and subsequent times.
Checked tvos (wireless connection ) and xcode.
ios device.

One of the overrides doesn’t apply.

Screenshot 2024-11-03 at 17 22 02

@Marius456 Marius456 added e2e and removed e2e labels Nov 4, 2024
Remove at least the throw part, which is the only important, should not matter for tvos
@RicardasN RicardasN added e2e and removed e2e labels Nov 5, 2024
@pauliusguzas
Copy link
Collaborator

On ios everything works as expected, on tvos when installing wirelessly both when app is preinstalled and not, everything works fine. However on cable in the case when app is preinstalled, it isn't launched

@pauliusguzas pauliusguzas merged commit 72bada7 into main Nov 8, 2024
12 of 13 checks passed
@pauliusguzas pauliusguzas deleted the fix/tvOS-launch branch November 8, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants