From f8de8c08c68398b5b5b871e655455f6d8c529d6e Mon Sep 17 00:00:00 2001 From: Vijay Vikram Singh Date: Fri, 28 Aug 2020 12:30:25 -0700 Subject: [PATCH] feat(ios): added new error constant and updated doc for local network privacy (#11896) Fixes TIMOB-28077 --- apidoc/Titanium/Network/BonjourBrowser.yml | 29 +++++++++++++++++++ apidoc/Titanium/Network/BonjourService.yml | 29 +++++++++++++++++++ iphone/Classes/TiNetworkBonjourServiceProxy.m | 5 ++++ 3 files changed, 63 insertions(+) diff --git a/apidoc/Titanium/Network/BonjourBrowser.yml b/apidoc/Titanium/Network/BonjourBrowser.yml index 1b7402e80b0..e6148ec853a 100644 --- a/apidoc/Titanium/Network/BonjourBrowser.yml +++ b/apidoc/Titanium/Network/BonjourBrowser.yml @@ -14,6 +14,35 @@ description: | services list, but you should not rely on it being delivered before user input. When a window which uses Bonjour browsing is closed, if you do not want to continue searching, you must call the stop() method. + + In iOS 14.0+, to browse services add key `NSLocalNetworkUsageDescription` and `NSBonjourServices` to the `ios plist` section of the tiapp.xml file. + + Example: + + ``` xml + + + + + + + NSLocalNetworkUsageDescription + + Specify the reason for accessing the local network. + This appears in the alert dialog when asking the user + for permission to access local network. + + + NSBonjourServices + + _test._tcp + + + + + + + ``` extends: Titanium.Proxy since: "1.2.0" platforms: [iphone, ipad] diff --git a/apidoc/Titanium/Network/BonjourService.yml b/apidoc/Titanium/Network/BonjourService.yml index d485e115ba3..9d766a2bd99 100644 --- a/apidoc/Titanium/Network/BonjourService.yml +++ b/apidoc/Titanium/Network/BonjourService.yml @@ -12,6 +12,35 @@ description: | the service first. When a window which publishes a Bonjour service is closed, you must stop the service if the associated socket is also to be closed, or if it is no longer necessary to publish. Bonjour service resolution and publishing is asynchronous. + + In iOS 14.0+, to publish service add key `NSLocalNetworkUsageDescription` and `NSBonjourServices` in tiapp.xml file. + + Example: + + ``` xml + + + + + + + NSLocalNetworkUsageDescription + + Specify the reason for accessing the local network. + This appears in the alert dialog when asking the user + for permission to access local network. + + + NSBonjourServices + + _test._tcp + + + + + + + ``` extends: Titanium.Proxy since: "1.2.0" platforms: [iphone, ipad] diff --git a/iphone/Classes/TiNetworkBonjourServiceProxy.m b/iphone/Classes/TiNetworkBonjourServiceProxy.m index 61f28f863dd..c0295980ee1 100644 --- a/iphone/Classes/TiNetworkBonjourServiceProxy.m +++ b/iphone/Classes/TiNetworkBonjourServiceProxy.m @@ -113,6 +113,11 @@ + (NSString *)stringForErrorCode:(NSNetServicesError)code case NSNetServicesTimeoutError: return @"TimeoutError"; break; +#if IS_SDK_IOS_14 + case NSNetServicesMissingRequiredConfigurationError: + return @"MissingRequiredConfigurationError"; + break; +#endif } return @"";