Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5047e5a

Browse files
authored
Started printing out error messages when the observatory won't be reachable because of permissions problems. (#20960)
1 parent 9d6152c commit 5047e5a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

shell/platform/darwin/ios/framework/Source/FlutterObservatoryPublisher.mm

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,25 @@ - (void)publishServiceProtocolPort:(NSString*)uri {
113113

114114
if (err != 0) {
115115
FML_LOG(ERROR) << "Failed to register observatory port with mDNS.";
116+
if (@available(iOS 14.0, *)) {
117+
FML_LOG(ERROR) << "Make sure the 'NSBonjourServices' key is set in your Info.plist for '"
118+
<< registrationType << "' for the Debug/Profile configurations."
119+
<< "(See also: https://developer.apple.com/news/?id=0oi77447)";
120+
}
116121
} else {
117122
DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue());
118123
}
119124
}
120125

126+
/// TODO(aaclarke): Remove this preprocessor macro once infra is moved to Xcode 12.
127+
static const DNSServiceErrorType kFlutter_DNSServiceErr_PolicyDenied =
128+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000
129+
kDNSServiceErr_PolicyDenied;
130+
#else
131+
// Found in usr/include/dns_sd.h.
132+
-65570;
133+
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED
134+
121135
static void DNSSD_API registrationCallback(DNSServiceRef sdRef,
122136
DNSServiceFlags flags,
123137
DNSServiceErrorType errorCode,
@@ -127,6 +141,11 @@ static void DNSSD_API registrationCallback(DNSServiceRef sdRef,
127141
void* context) {
128142
if (errorCode == kDNSServiceErr_NoError) {
129143
FML_DLOG(INFO) << "FlutterObservatoryPublisher is ready!";
144+
} else if (errorCode == kFlutter_DNSServiceErr_PolicyDenied) {
145+
FML_LOG(ERROR)
146+
<< "Could not register as server for FlutterObservatoryPublisher, permission "
147+
<< "denied. Check your 'Local Network' permissions for this app in the Privacy section of "
148+
<< "the system Settings.";
130149
} else {
131150
FML_LOG(ERROR) << "Could not register as server for FlutterObservatoryPublisher. Check your "
132151
"network settings and relaunch the application.";

0 commit comments

Comments
 (0)