Skip to content

Commit

Permalink
feat(ios): added new error constant and updated doc for local network…
Browse files Browse the repository at this point in the history
… privacy (#11896)

Fixes TIMOB-28077
  • Loading branch information
vijaysingh-axway authored Aug 28, 2020
1 parent dbdb869 commit f8de8c0
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
29 changes: 29 additions & 0 deletions apidoc/Titanium/Network/BonjourBrowser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
<ti:app>
<!-- ... -->
<ios>
<plist>
<dict>
<!-- Reason to access local network-->
<key>NSLocalNetworkUsageDescription</key>
<string>
Specify the reason for accessing the local network.
This appears in the alert dialog when asking the user
for permission to access local network.
</string>
<!-- List of bonjour service type-->
<key>NSBonjourServices</key>
<array>
<string>_test._tcp</string>
<array/>
</dict>
</plist>
</ios>
<!-- ... -->
</ti:app>
```
extends: Titanium.Proxy
since: "1.2.0"
platforms: [iphone, ipad]
Expand Down
29 changes: 29 additions & 0 deletions apidoc/Titanium/Network/BonjourService.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
<ti:app>
<!-- ... -->
<ios>
<plist>
<dict>
<!-- Reason to access local network-->
<key>NSLocalNetworkUsageDescription</key>
<string>
Specify the reason for accessing the local network.
This appears in the alert dialog when asking the user
for permission to access local network.
</string>
<!-- List of bonjour service type-->
<key>NSBonjourServices</key>
<array>
<string>_test._tcp</string>
<array/>
</dict>
</plist>
</ios>
<!-- ... -->
</ti:app>
```
extends: Titanium.Proxy
since: "1.2.0"
platforms: [iphone, ipad]
Expand Down
5 changes: 5 additions & 0 deletions iphone/Classes/TiNetworkBonjourServiceProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 @"";
Expand Down

0 comments on commit f8de8c0

Please sign in to comment.