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

Black screen when launching for debugging on iOS 11 #358

Closed
JackAppDev opened this issue Jul 13, 2017 · 48 comments
Closed

Black screen when launching for debugging on iOS 11 #358

JackAppDev opened this issue Jul 13, 2017 · 48 comments
Labels
fixed in dart / flutter in flutter Relates to running Flutter apps

Comments

@JackAppDev
Copy link

JackAppDev commented Jul 13, 2017

using version from vscode extension marketplace

  1. flutter create testapp
  2. cd testapp
  3. Debug > Start Debugging
  4. select "flutter mobile app"
  5. Debug > Start Debugging - again
  6. App launches as black screen

Edit (@DanTup): Related flutter issue -> flutter/flutter#10602

@JackAppDev JackAppDev changed the title Black screen when launching on mac Black screen when launching app on mac Jul 13, 2017
@Skylled
Copy link
Contributor

Skylled commented Jul 13, 2017

Just to be sure, the app works correctly from flutter run?

Can you paste the logs from the debug console and flutter run -v?

@JackAppDev
Copy link
Author

It launches fine with flutter run however I get the black screen when trying to use vscode itself

@Skylled
Copy link
Contributor

Skylled commented Jul 13, 2017

Wow, iOS verbose logs are intense.

So, given that the error still occurs when Dart-Code isn't involved, I suggest bringing the problem to the main Flutter repo. Someone with more Mac/iOS experience should be able to help you.

@JackAppDev
Copy link
Author

no it only happens when using dart-code

@DanTup DanTup added in debugger Relates to the debug adapter or process of launching a debug session in flutter Relates to running Flutter apps is bug labels Jul 13, 2017
@DanTup DanTup added this to the v2.1 milestone Jul 13, 2017
@DanTup
Copy link
Member

DanTup commented Jul 13, 2017

@JackAppDev Could you try enabling the Observatory and FlutterRun logs (see here) and attaching them (after reviewing for no personal data).

I removed the super-verbose comment above; I don't think it's relevant atm (esp. if it works outside Dart Code) and was tedious scrolling here on mobile =)

@Dart-Code Dart-Code deleted a comment from JackAppDev Jul 13, 2017
@DanTup
Copy link
Member

DanTup commented Jul 13, 2017

@JackAppDev Also, can you post the version of the Dart SDK being used (it'll appear bottom right of the status bar in Dart Code), VS Code version and what device you're using (Android or iOS, emulator or physical)? Thanks!

@DanTup
Copy link
Member

DanTup commented Jul 13, 2017

Another thing to check - Help -> Show Developer Tools; do any errors show up in the Chrome console?

@JackAppDev
Copy link
Author

JackAppDev commented Jul 14, 2017

@DanTup
Observatory file wasn't created
run.txt

dart is the most up to date installed with homebrew
vs code version 1.14.0
flutter is 1.24.0-dev.6.7
using my physical iPhone
no errors in dev tools

@DanTup
Copy link
Member

DanTup commented Jul 14, 2017

@JackAppDev

dart is the most up to date installed with homebrew

Flutter actually includes its own version of the SDK which is what's used here (in this case 1.24.0-dev.6.7), which I think is fairly recent.

Based on the flutter run log it seems like something has errored - it's written a timestamp with no data (this normally happens because it writes the response then crashes/pauses before it gets flushed).

Can you try running flutter run --machine from the same folder (this is all Dart Code is doing) and then post the output here (it should look similar to the log you attached, but hopefully includes whatever line wasn't flushed correctly here). I'll also look at making sure these logs flush in future.

@JackAppDev
Copy link
Author

@DanTup

Jacks-MacBook-Pro:testapp jack$ flutter run --machine -d 07a210f7588fe7c51da7ccbcdbb3958d57b3572d
[{"event":"app.start","params":{"appId":"14a36cb0-0e73-4ba7-b41f-e4ff227f0f0d","deviceId":"07a210f7588fe7c51da7ccbcdbb3958d57b3572d","directory":"/User
s/jack/Desktop/flut/testapp","supportsRestart":true}}]
Launching lib/main.dart on Jack's iPhone in debug mode...
Signing iOS app for device deployment using developer identity: "iPhone Developer: Jack O'Donnell (GH5FTELEB5)"
[{"event":"app.progress","params":{"appId":"14a36cb0-0e73-4ba7-b41f-e4ff227f0f0d","id":"0","progressId":null,"message":"Running Xcode build..."}}]
[{"event":"app.progress","params":{"appId":"14a36cb0-0e73-4ba7-b41f-e4ff227f0f0d","id":"0","progressId":null,"finished":true}}]
[{"event":"app.stop","params":{"appId":"14a36cb0-0e73-4ba7-b41f-e4ff227f0f0d","error":"Timeout while attempting to retrieve URL for Observatory"}}]

@DanTup
Copy link
Member

DanTup commented Jul 14, 2017

This seems like a flutter issue :( Could you raise at flutter/flutter and post the link back here?

@JackAppDev
Copy link
Author

@DanTup The issue only happens when trying to do "start debugging" in vscode. It works perfectly whenever I try to use any terminal. I have also noticed that the app after being launched as a black screen, relaunching via my phone will fix the issue. If I launch from any other ide (Xcode/intellij) it works as it should. Does this new information make you still think the issue is flutter?

@Skylled
Copy link
Contributor

Skylled commented Jul 14, 2017

The reason that it's believed to be a flutter issue, is that running flutter run --machine from the command line and finding the same problem means that you've taken Dart-Code out of the equation and the fault lies in Flutter.

@DanTup
Copy link
Member

DanTup commented Jul 14, 2017

@JackAppDev

The issue only happens when trying to do "start debugging" in vscode. It works perfectly whenever I try to use any terminal

I'm slightly confused, the log you posted above suggests that flutter run --machine had the same failure:

Jacks-MacBook-Pro:testapp jack$ flutter run --machine -d 07a210f7588fe7c51da7ccbcdbb3958d57b3572d
...
[{"event":"app.stop","params":{"appId":"14a36cb0-0e73-4ba7-b41f-e4ff227f0f0d","error":"Timeout while attempting to retrieve URL for Observatory"}}]

It was my understanding that this eliminated Dart Code from the equation?

I'm not trying to fob you off - I care very much about making sure Dart Code works for people, but with the log above it seems like the failure is not in Dart Code and I'm not sure how I can debug.

@DanTup
Copy link
Member

DanTup commented Jul 14, 2017

@xster @Hixie This seems like it might be related to (or the same as) flutter/flutter#10125 or flutter/flutter#10228. I don't know how to tell if the fix there has shipped yet - can you tell if it's shipped and/or let me know how I can best tell when a changeset is out (I'm not familiar with the flutter release process at all).

@JackAppDev
Copy link
Author

JackAppDev commented Jul 14, 2017

@DanTup heres what happens:
flutter run = app works without debug info
flutter run --machine = app works without debug info
green arrow in debug section of vscode = black screen no debug info either
xcode = works with debugging info (prints to console)

could this be related to me using Xcode 9 on macOS 10.13 and iOS 11?

@Skylled
Copy link
Contributor

Skylled commented Jul 14, 2017

Try running flutter channel master then flutter upgrade to see if that has any effect.

@JackAppDev
Copy link
Author

@Skylled same thing :(

@DanTup
Copy link
Member

DanTup commented Jul 14, 2017

flutter run --machine = app works without debug info
green arrow in debug section of vscode = black screen no debug info either

Ok, I think I can explain this bit.. When you run with flutter run --machine we can see it's failing to get a connection to Observatory. When Dart Code runs the app, this is a critical failure because we have to launch the app paused so that we can send breakpoints to the VM before it starts running (to avoid a race for breakpoints in startup code). This means the failure to connect to observatory is fatal when run from VS Code since the app remains paused before it displayed anything. The reason it looks different with flutter run --machine is just because I didn't tell you to also pass --start-paused which is what VS Code does. If you do that you'll see the same behaviour (a black screen) though it's not terribly useful since you'd need to connect a debugger and unpause.

I can't explain why it works from another IDE but there have been many issues raised here that "only happen in VS Code" which turn out to be bugs elsewhere (that's not to say it hasn't had its fair share of bugs!). Sometimes they're just fluke, sometimes they're race conditions caused by slight differences in behaviour and sometimes they do turn out to be reproducible elsewhere when properly checked. There's also the possibility that other IDEs don't use exactly the same tools (for example you can launch flutter apps via flutter daemon and I don't know if that might have different behaviour or performance characteristics - which could affect race conditions). There are lots of variables and a lot of moving parts!

I really want to see this issue fixed - if it affects you it will affect other Dart Code users - but I genuinely believe at this point that the best people to diagnose/fix this are the Flutter team. I have nothing to gain by fobbing you off and I really care about my software and do not want unhappy users. I'm suggesting what I think will get the issue fixed, not what is just least work for me (I wouldn't be working on Dart Code if I wasn't happy doing work!).

@xster
Copy link

xster commented Jul 14, 2017

#358 (comment) is a sensible explanation.

Unfortunately I can't reproduce the same issue with the 2.0.0 extension. (Also cc @devoncarew)

flutter/flutter#10228 is an issue with the tool failing to install onto the simulator.

@JackAppDev, do you mind also sharing your flutter doctor output for more clues?

@xster
Copy link

xster commented Jul 14, 2017

Looks like @cbracken might be looking at similar issues at flutter/flutter#11195

@DanTup DanTup added the blocked on dart / flutter Requires a change in Dart or Flutter to progress label Jul 14, 2017
@xster
Copy link

xster commented Jul 14, 2017

As Chris mentioned, it's a known iOS 11 issue turns out.

All permutations of debugging doesn't work yet. (We have trouble getting the device's open port used for various debugging related tasks back to the mac on iOS 11).

You can launch in Intellij/Xcode but they should have similar issues (breakpoints won't work).

Maybe one minor dart code specific tweak might be to make 'Start Without Debugging' work. Doesn't seem to work for me.

For now, the debugging issue is know and work's in progress. In the meantime, debugging etc works for iOS 10 devices.

@DanTup
Copy link
Member

DanTup commented Jul 14, 2017

Maybe one minor dart code specific tweak might be to make 'Start Without Debugging' work. Doesn't seem to work for me.

What happens when you try? (If possible, please put details in a new issue).

@JackAppDev
Copy link
Author

it works

@DanTup
Copy link
Member

DanTup commented Jul 15, 2017

@JackAppDev Do you mean "start without debugging" works for you? If so, @xster can you provide info on what you see and which platforms you're using (Mac, iOS, Emulator?) in a new case. Ta!

@DanTup DanTup removed this from the v2.1 milestone Jul 15, 2017
@JackAppDev
Copy link
Author

@DanTup yes "start without debugging" launches the app for me correctly without the black screen.

@DanTup
Copy link
Member

DanTup commented Jul 16, 2017

@JackAppDev That's good to know. Seems fine for me too, so I'll investigate @xster's issue if he can raise a new issue with more info.

Based on the above, are you happy that your issue is the Flutter iOS issue mentioned above? I'll leave this issue open until it's fixed in Flutter in case others come looking, but I don't think there's anything I can do to fix (or even work around) this :(

@DanTup DanTup changed the title Black screen when launching app on mac Black screen when launching for debugging on iOS Jul 16, 2017
@DanTup
Copy link
Member

DanTup commented Jul 16, 2017

I guess this highlights another issue though - I'm set up on a Mac with an Android emulator but not iOS =D I'll get that sorted!

@JackAppDev JackAppDev changed the title Black screen when launching for debugging on iOS Black screen when launching for debugging on iOS 11 Jul 16, 2017
@JackAppDev
Copy link
Author

@DanTup Yes I'm happy that I now know I can use the iOS 10 simulator with Dart-Code. I am very happy that it works as it should with hot reload and all. Waiting 30+ seconds for each change was becoming unbearable.

@xster
Copy link

xster commented Jul 17, 2017

Done. Split into #366.

@cbracken
Copy link

Update: Xcode 9 + iOS 11 are now supported. Running flutter doctor on the command line when an iOS 11 device is attached should output the following:

[-] iOS toolchain - develop for iOS devices (Xcode 9.0)
    • Xcode at /Applications/Xcode9.0.app/Contents/Developer
    • Xcode 9.0, Build version 9M214v
    ✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
        brew uninstall --ignore-dependencies libimobiledevice
        brew install --HEAD libimobiledevice
        brew install ideviceinstaller
    • ios-deploy 1.9.1
    • CocoaPods version 1.3.1

Running the steps outlined should resolve the issue:

brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller

Then re-run flutter doctor once to verify no issues are found.

Note that Xcode 9 is required for iOS 11 development. If you've got side-by-side installs of Xcode 8 and the Xcode 9 beta, you'll need to use the xcode-select command-line tool to ensure that the Xcode 9 command-line build tools are selected.

To check which tools are currently selected, run:

xcode-select -p

To switch to another Xcode version, run sudo xcode-select -s INSTALL_PATH. For an Xcode 9 beta install in /Applications, the command would be:

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

@JackAppDev
Copy link
Author

@cbracken Do you know perhaps if it will work on macOS 10.13? Ive had issues with iOS-deploy working on 10.13

@cbracken
Copy link

cbracken commented Aug 30, 2017

@JackAppDev excellent question. I don't have ready access to a 10.13 machine, but I'll try to get one set up ASAP.

Thank you for reporting this. If you haven't already, would you mind filing a bug in the Flutter repo issues with details (and CC me)?

Also worth checking if the issue isn't flutter/flutter#4326. There's a workaround until we've added a flutter doctor check for it.

EDIT (2017-08-31): got my hands on a 10.13 machine. Looks like ios-deploy is not yet successfully building on 10.13. Issue is ios-control/ios-deploy#308. I've opened a Flutter tracking bug at flutter/flutter#11875.

@cbracken
Copy link

cbracken commented Sep 5, 2017

Update: I've sent ios-control/ios-deploy#314, which resolves this issue and is now merged.

Waiting on homebrew to update the ios-deploy formula -- PR: Homebrew/homebrew-core#17660. Once that lands, we should be all set for iOS11 / Xcode 9 / macOS 10.13 High Sierra.

EDIT (2017-09-05): iOS-deploy is updated to 1.9.2 on homebrew now. Flutter should be good to go with iOS 11 / Xcode 9 / macOS 10.13 High Sierra.

@cbracken
Copy link

cbracken commented Sep 5, 2017

@JackAppDev can you give a go now and let me know if any issues remain for you?

@JackAppDev
Copy link
Author

@cbracken thanks ill check it out

@JackAppDev
Copy link
Author

JackAppDev commented Sep 6, 2017

@cbracken ios-deploy installs! Still have the black screen issue though :/ I’ll update this comment with the error later

Update: log is

Launching lib/main.dart on Jack's iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 8E8ZZ4K42D
Retrieving resting unlock: 0
You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
refreshPreferences: HangTracerEnabled: 1
refreshPreferences: HangTracerDuration: 500
refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
Exited (sigterm)

@cbracken
Copy link

cbracken commented Sep 6, 2017

@JackAppDev Thanks! Couple questions:

  1. Can you provide the output of flutter doctor?
  2. Can you try flutter run --verbose and add the logs here?

@JackAppDev
Copy link
Author

JackAppDev commented Sep 6, 2017

@cbracken

Jacks-MacBook-Pro:chatter jack$ flutter doctor
[✓] Flutter (on Mac OS X 10.13 17A358a, locale en-US, channel master)
    • Flutter at /Users/jack/flutter
    • Framework revision 3b76e7e258 (4 weeks ago), 2017-08-08 15:46:47 -0700
    • Engine revision f0d440bec3
    • Tools Dart version 1.25.0-dev.7.0

[✓] Android toolchain - develop for Android devices (Android SDK 26.0.1)
    • Android SDK at /Users/jack/Library/Android/sdk
    • Platform android-26, build-tools 26.0.1
    • ANDROID_HOME = /Users/jack/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.0)
    • Xcode at /Applications/Xcode-beta.app/Contents/Developer
    • Xcode 9.0, Build version 9M214v
    • ios-deploy 1.9.2
    • CocoaPods version 1.3.1

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Community Edition (version 2017.2.1)
    • Flutter plugin version 16.0
    • Dart plugin version 172.3544.34

[✓] Connected devices
    • Android SDK built for x86 • emulator-5554                            • android-x86 • Android 8.0.0 (API 26) (emulator)
    • Jack's iPhone             • 07a210f7588fe7c51da7ccbcdbb3958d57b3572d • ios         • iOS 11.0

@DanTup
Copy link
Member

DanTup commented Sep 30, 2017

Is this still an issue? Is there a related Flutter issue I can close this in favour of? If I understand correctly, it's no Dart Code specific, so nothing I can do to progress?

@cbracken
Copy link

As far as I’m aware there are no Xcode 9, iOS 11, or macOS 10.13 issues remaining in Flutter on the master branch. The alpha branch hasn’t yet been rolled but we’re hoping to do that soon.

@DanTup
Copy link
Member

DanTup commented Sep 30, 2017

Ok, closing this then :-)

@DanTup DanTup closed this as completed Sep 30, 2017
@DanTup DanTup added fixed in dart / flutter and removed in debugger Relates to the debug adapter or process of launching a debug session is bug blocked on dart / flutter Requires a change in Dart or Flutter to progress labels Sep 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in dart / flutter in flutter Relates to running Flutter apps
Projects
None yet
Development

No branches or pull requests

5 participants