79 :(NSURL*)url {
80
81 FML_LOG(INFO) <<
"Publish Service Protocol Port";
82 DNSServiceFlags
flags = kDNSServiceFlagsDefault;
83#if TARGET_IPHONE_SIMULATOR
84
85 uint32_t interfaceIndex = if_nametoindex("lo0");
86#else
87
88 uint32_t interfaceIndex = 0;
89#endif
90 const char* registrationType = "_dartVmService._tcp";
91
92 const char* domain = "local.";
93 uint16_t
port = [[url port] unsignedShortValue];
94
96 int err = DNSServiceRegister(&_dnsServiceRef,
flags, interfaceIndex,
98 registrationType, domain, NULL, htons(
port), txtData.length,
100
101 if (err == 0) {
102 DNSServiceSetDispatchQueue(_dnsServiceRef, dispatch_get_main_queue());
103 return;
104 }
105
106 FML_LOG(
ERROR) <<
"Failed to register Dart VM Service port with mDNS with error " << err <<
".";
107 if (@available(iOS 14.0, *)) {
108 FML_LOG(
ERROR) <<
"On iOS 14+, local network broadcast in apps need to be declared in "
109 << "the app's Info.plist. Debug and profile Flutter apps and modules host "
110 << "VM services on the local network to support debugging features such "
111 << "as hot reload and DevTools. To make your Flutter app or module "
112 << "attachable and debuggable, add a '" << registrationType << "' value "
113 << "to the 'NSBonjourServices' key in your Info.plist for the Debug/"
114 << "Profile configurations. " << "For more information, see "
115 << "https://flutter.dev/docs/development/add-to-app/ios/"
116 "project-setup#local-network-privacy-permissions";
117 }
118}
FlutterSemanticsFlag flags
#define FML_LOG(severity)
static void DNSSD_API RegistrationCallback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regType, const char *domain, void *context)
NSData * createTxtData:(NSURL *url)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service port