From 2a4142e484138c2cde769df3aedcd3a778d906e8 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 2 Sep 2020 14:52:46 -0700 Subject: [PATCH 1/3] Started printing out error messages when the observatory won't be reachable because of permissions problems. --- .../framework/Source/FlutterObservatoryPublisher.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index d73c0e76ac495..ff8c8596f2bad 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -113,6 +113,11 @@ - (void)publishServiceProtocolPort:(NSString*)uri { 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 << "'. " + << "(See also: https://developer.apple.com/news/?id=0oi77447)"; + } } else { DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue()); } @@ -127,6 +132,11 @@ static void DNSSD_API registrationCallback(DNSServiceRef sdRef, void* context) { if (errorCode == kDNSServiceErr_NoError) { FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!"; + } else if (errorCode == kDNSServiceErr_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."; From f47ff27dda9f67d4b80d56f1adf5133239565bcb Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Wed, 2 Sep 2020 16:19:03 -0700 Subject: [PATCH 2/3] addressed jenn's feedback --- .../framework/Source/FlutterObservatoryPublisher.mm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index ff8c8596f2bad..78b60461dcaa5 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -115,7 +115,7 @@ - (void)publishServiceProtocolPort:(NSString*)uri { 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 << "'. " + << registrationType << "' for the Debug configuration." << "(See also: https://developer.apple.com/news/?id=0oi77447)"; } } else { @@ -123,6 +123,15 @@ - (void)publishServiceProtocolPort:(NSString*)uri { } } +/// 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, @@ -132,7 +141,7 @@ static void DNSSD_API registrationCallback(DNSServiceRef sdRef, void* context) { if (errorCode == kDNSServiceErr_NoError) { FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!"; - } else if (errorCode == kDNSServiceErr_PolicyDenied) { + } 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 " From 24ec22ffc4f6e2f528a0cc62119809d133ef05d9 Mon Sep 17 00:00:00 2001 From: Aaron Clarke Date: Thu, 3 Sep 2020 13:09:58 -0700 Subject: [PATCH 3/3] added note on profile --- .../darwin/ios/framework/Source/FlutterObservatoryPublisher.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm index 78b60461dcaa5..59be0c31e8479 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm @@ -115,7 +115,7 @@ - (void)publishServiceProtocolPort:(NSString*)uri { 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 configuration." + << registrationType << "' for the Debug/Profile configurations." << "(See also: https://developer.apple.com/news/?id=0oi77447)"; } } else {