Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | List of all members
DartVMServiceDNSServiceDelegate Class Reference
Inheritance diagram for DartVMServiceDNSServiceDelegate:
<FlutterDartVMServicePublisherDelegate>

Instance Methods

(void) - stopService [implementation]
 
(void) - publishServiceProtocolPort: [implementation]
 

Class Methods

(static void DNSSD_API) + RegistrationCallback [implementation]
 

Detailed Description

Definition at line 65 of file FlutterDartVMServicePublisher.mm.

Method Documentation

◆ publishServiceProtocolPort:

- (void) publishServiceProtocolPort: (NSURL*)  url
implementation

Reimplemented from <FlutterDartVMServicePublisherDelegate>.

Definition at line 61 of file FlutterDartVMServicePublisher.mm.

79 :(NSURL*)url {
80 // TODO(vashworth): Remove once done debugging https://github.com/flutter/flutter/issues/129836
81 FML_LOG(INFO) << "Publish Service Protocol Port";
82 DNSServiceFlags flags = kDNSServiceFlagsDefault;
83#if TARGET_IPHONE_SIMULATOR
84 // Simulator needs to use local loopback explicitly to work.
85 uint32_t interfaceIndex = if_nametoindex("lo0");
86#else // TARGET_IPHONE_SIMULATOR
87 // Physical devices need to request all interfaces.
88 uint32_t interfaceIndex = 0;
89#endif // TARGET_IPHONE_SIMULATOR
90 const char* registrationType = "_dartVmService._tcp";
91
92 const char* domain = "local."; // default domain
93 uint16_t port = [[url port] unsignedShortValue];
94
95 NSData* txtData = [FlutterDartVMServicePublisher createTxtData:url];
96 int err = DNSServiceRegister(&_dnsServiceRef, flags, interfaceIndex,
98 registrationType, domain, NULL, htons(port), txtData.length,
99 txtData.bytes, RegistrationCallback, NULL);
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)
Definition logging.h:82
static void DNSSD_API RegistrationCallback(DNSServiceRef sdRef, DNSServiceFlags flags, DNSServiceErrorType errorCode, const char *name, const char *regType, const char *domain, void *context)
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
Definition switches.h:87
#define ERROR(message)

◆ RegistrationCallback

+ (static void DNSSD_API) RegistrationCallback (DNSServiceRef)  sdRef
(DNSServiceFlags)  flags
(DNSServiceErrorType)  errorCode
(const char *)  name
(const char *)  regType
(const char *)  domain
(void *)  context 
implementation

Definition at line 120 of file FlutterDartVMServicePublisher.mm.

126 {
127 if (errorCode == kDNSServiceErr_NoError) {
128 FML_DLOG(INFO) << "FlutterDartVMServicePublisher is ready!";
129 } else if (errorCode == kDNSServiceErr_PolicyDenied) {
131 << "Could not register as server for FlutterDartVMServicePublisher, permission "
132 << "denied. Check your 'Local Network' permissions for this app in the Privacy section of "
133 << "the system Settings.";
134 } else {
135 FML_LOG(ERROR) << "Could not register as server for FlutterDartVMServicePublisher. Check your "
136 "network settings and relaunch the application.";
137 }
138}
#define FML_DLOG(severity)
Definition logging.h:102

◆ stopService

- (void) stopService
implementation

Reimplemented from <FlutterDartVMServicePublisherDelegate>.

Definition at line 61 of file FlutterDartVMServicePublisher.mm.

72 {
73 if (_dnsServiceRef) {
74 DNSServiceRefDeallocate(_dnsServiceRef);
75 _dnsServiceRef = NULL;
76 }
77}

The documentation for this class was generated from the following file: