From 1302a1806a11e92aba296101b38ed525a599bb06 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Thu, 3 Sep 2020 14:05:47 -0700 Subject: [PATCH] Started printing out error messages when the observatory won't be reachable because of permissions problems. (flutter/engine#20960) --- .../Source/FlutterObservatoryPublisher.mm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index d73c0e76ac..59be0c31e8 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -113,11 +113,25 @@ if (err != 0) { FML_LOG(ERROR) << "Failed to register observatory port with mDNS."; + if (@available(iOS 14.0, *)) { + FML_LOG(ERROR) << "Make sure the 'NSBonjourServices' key is set in your Info.plist for '" + << registrationType << "' for the Debug/Profile configurations." + << "(See also: https://developer.apple.com/news/?id=0oi77447)"; + } } else { DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue()); } } +/// TODO(aaclarke): Remove this preprocessor macro once infra is moved to Xcode 12. +static const DNSServiceErrorType kFlutter_DNSServiceErr_PolicyDenied = +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 + kDNSServiceErr_PolicyDenied; +#else + // Found in usr/include/dns_sd.h. + -65570; +#endif // __IPHONE_OS_VERSION_MAX_ALLOWED + static void DNSSD_API registrationCallback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, @@ -127,6 +141,11 @@ static void DNSSD_API registrationCallback(DNSServiceRef sdRef, void* context) { if (errorCode == kDNSServiceErr_NoError) { FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!"; + } else if (errorCode == kFlutter_DNSServiceErr_PolicyDenied) { + FML_LOG(ERROR) + << "Could not register as server for FlutterObservatoryPublisher, permission " + << "denied. Check your 'Local Network' permissions for this app in the Privacy section of " + << "the system Settings."; } else { FML_LOG(ERROR) << "Could not register as server for FlutterObservatoryPublisher. Check your " "network settings and relaunch the application.";