Skip to content

Xcode 15 launch failure with iOS 17 physical device in debug mode "Could not call ptrace(PT_TRACE_ME): Operation not permitted. Cannot create a FlutterEngine instance in debug mode without Flutter tooling or Xcode." #136197

Closed

Description

@NM4ik

Is there an existing issue for this?

Steps to reproduce

  • flutter channel master
  • flutter upgrade
  • ios -> pod install --repo-update
  • flutter clean
  • flutter pub get
  • flutter run (--debug)

Actual results

After updating iOS 17 and xCode 15, I can’t launch debug mode on a physical Apple device.

  • flutter channel master (Flutter 3.16.0-6.0.pre.45 • channel master)
  • flutter upgrade
  • ios -> pod install --repo-update
  • flutter clean
  • flutter pub get
  • flutter run (--debug)

and im running debug from vs code command-line and xcode

image
image
image
image

and sometime i got this notification
image

Logs

Logs
<!-- Paste your logs here -->

Flutter Doctor output

Doctor output
nikitamihajlov@Mac-mini-Nikita ios % flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.16.0-6.0.pre.45, on macOS 14.0 23A344 darwin-arm64)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.83.0)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.

Activity

  1. Ivan981508 commented on Oct 9, 2023

    @Ivan981508
  2. changed the title [-]Xcode 15 launch failure with iOS 17 physical device in debug mode "Could not obtain access to one or more requested file system resources because CoreDevice was unable to create bookmark data." You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security > Automation.[/-] [+]Xcode 15 launch failure with iOS 17 physical device in debug mode "Could not obtain access to one or more requested file system resources because CoreDevice was unable to create bookmark data." You may be prompted to give access to control Xcode[/+] on Oct 9, 2023
  3. Sgooll commented on Oct 9, 2023

    @Sgooll
  4. berkaykurkcu commented on Oct 9, 2023

    @berkaykurkcu

    I have the same issue. When I try to run with VS Code 's "Start Debugging" option, Debug Console outputs

    [VERBOSE-2:ptrace_check.cc(75)] Could not call ptrace(PT_TRACE_ME): Operation not permitted
    Cannot create a FlutterEngine instance in debug mode without Flutter tooling or Xcode.
    

    Only way I could launch the app on my Physical Device is by running "flutter run --profile" but that doesn't seem to completely work as well. It's getting stuck at "Installing and launching..." section, but the app is running on my device. Force-closing the operation and running with VS Code's "Start debugging", the app is built on my Physical Device, but still stuck with the warning

    The Dart VM Service was not discovered after 60 seconds. This is taking much longer than expected...
    Open the Xcode window the project is opened in to ensure the app is running. If the app is not running, try selecting "Product > Run" to fix the problem.
    
  5. likwifi commented on Oct 9, 2023

    @likwifi
  6. vashworth commented on Oct 9, 2023

    @vashworth
    Contributor

    Seems like the check we use to determine if the app was launched from Xcode appears to be failing occasionally.

    https://github.com/flutter/engine/blob/22ce5c6a45e2898b4ce348c514b5fa42ca25bc88/runtime/ptrace_check.cc#L56-L71

    I believe this is causing it to try enabling manual tracing, which would cause the "Could not call ptrace" and "Cannot create a FlutterEngine instance in debug mode without Flutter tooling or Xcode" error.

  7. vashworth commented on Oct 9, 2023

    @vashworth
    Contributor

    @NM4ik When you get the "Could not obtain access to one or more requested file system resources because CoreDevice was unable to create bookmark data." Xcode error, could you click the "Show Details" button and include the logs from it?

  8. acoutts commented on Oct 9, 2023

    @acoutts

    I find clearing data in xcode (cmd + k) and then exiting xcode, then re-running from vscode usually works. But it's quite annoying having to do this several times a day now.

  9. NM4ik commented on Oct 9, 2023

    @NM4ik
    Author
  10. NM4ik commented on Oct 9, 2023

    @NM4ik
    Author

    I find clearing data in xcode (cmd + k) and then exiting xcode, then re-running from vscode usually works. But it's quite annoying having to do this several times a day now.

    not working for me :d

  11. acoutts commented on Oct 9, 2023

    @acoutts

    Sorry it's cmd + shift + k to clean the build folder (derived data).

  12. vashworth commented on Oct 9, 2023

    @vashworth
  13. NM4ik commented on Oct 9, 2023

    @NM4ik
    Author
  14. vashworth commented on Oct 9, 2023

    @vashworth
  15. 24 remaining items

  16. vashworth commented on Oct 16, 2023

    @vashworth
    Contributor

    @NM4ik Can you open your project in Xcode (e.g. your_project/ios/your_project.xcworkspace) and do "Product > Run". This should trigger Xcode to build and launch your application, then in the Report Navigator, right-click on the Build step and click "Show in Finder".

    Screenshot 2023-10-16 at 3 56 09 PM

    This should open Finder to a xcresult file. Then can you right-click on the xcresult file and compress it and upload the zip file to this issue?
    Screenshot 2023-10-16 at 4 05 44 PM

  17. NM4ik commented on Oct 17, 2023

    @NM4ik
    Author

    @vashworth
    [file]

  18. vashworth commented on Oct 17, 2023

    @vashworth
    Contributor

    @NM4ik Okay now it's making sense. So looks like your project is not launching a debugger, which would cause this issue. In Xcode, try going to "Product > Scheme > Edit Scheme" and under Run and Info make sure "Executable" is set to the default Runner.app and "Debug executable" is checked.

    Here's an example of what the correct settings should look like:

    Screenshot 2023-10-17 at 9 39 02 AM

    If your settings don't match the example, can you also include a screenshot of what they were? I'm curious about what your settings might be because by default they should match the example.

    Then try running again and see if it works. In Report Navigator, for the Launch step, there should be a "Debug Runner" section if the debugger was launched.

  19. NM4ik commented on Oct 17, 2023

    @NM4ik
    Author

    @vashworth

    image
    There were such settings after updating xCode

    It works! Thank you :D

    I did:
    enable Debug executable checkbox
    flutter channel stable (because master didnt work)
    flutter clean
    flutter pub get
    pod install --repo-update
    flutter run

  20. vashworth commented on Oct 17, 2023

    @vashworth
    Contributor

    @NM4ik Excellent! Thank you for your assistance in figuring this out!

  21. vashworth commented on Oct 17, 2023

    @vashworth
    Contributor

    I'm going to keep this issue open. I think actionable work for Flutter can be: we can try parsing the scheme settings and checking to ensure these settings are set as expected and if they're not, we can provide messaging to guide users to fix.

  22. NM4ik commented on Oct 17, 2023

    @NM4ik
    Author

    @vashworth
    I got u ! :D
    Is there anything else required from me?

  23. vashworth commented on Oct 17, 2023

    @vashworth
    Contributor

    @vashworth Got u ! :D Is there anything else required from me?

    Nope, I think I have all the information I need. Thanks!

  24. likwifi commented on Oct 18, 2023

    @likwifi

    @vashworth after couple times of successful launches with the Debug executable checked,
    I'm experiencing same issue again on stable branch.
    I've also attached xcresult.
    Not sure whats reason for this.
    Run-Runner-2023.10.18_19-55-54-+0400.xcresult.zip

  25. likwifi commented on Oct 18, 2023

    @likwifi

    after upgrade to flutter version 3.13.7 it works again 🤷‍♂️

  26. berkaykurkcu commented on Oct 20, 2023

    @berkaykurkcu

    Seems like the issue still persists and workarounds are not reliable.
    Applying @vashworth 's suggestion and running directly from XCode #136197 (comment)
    yields "Build Failed" with two issues.

    - Framework 'Pods_Runner' not found
    - Linker command failed with exit code 1
    

    Trying to launch from VS Code however yields a very different result.

    The item at Runner.app is not a valid bundle.
    Domain: com.apple.dt.CoreDeviceError
    Code: 3000
    Failure Reason: The path to the provided bundle's main executable could not be determined.
    

    However, after launching from VS Code and receiving the error above, navigating to XCode and taking a look inside the Runner's Frameworks folder, I see 'Pods_Runner' written in red.
    Simply deleting it and running from XCode again(keep in mind that @vashworth 's suggestion is still applied) somehow successfully launched the app.

  27. github-actions commented on Nov 8, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  28. locked as resolved and limited conversation to collaborators on Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: OS-version specificAffects only some versions of the relevant operating systemplatform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions