[TIMOB-28077] iOS14: Expose new error type in Bonjure Service and update doc to align with Local n/w privacy restrictions
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2020-09-11T18:31:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.2.0 |
Components | iOS |
Labels | bonjour, iOS |
Reporter | Vijay Singh |
Assignee | Vijay Singh |
Created | 2020-08-11T19:39:28.000+0000 |
Updated | 2020-09-11T18:31:13.000+0000 |
Description
In iOS 14, Apple has put restriction on accessing local network. It requires user permission.
To show the prompt developer need to add key [NSLocalNetworkUsageDescription](https://developer.apple.com/documentation/bundleresources/information_property_list/nslocalnetworkusagedescription?language=objc) in tiapp.xml and if using Bonjure Service, that need to be added in info.plist using key [NSBonjourServices ](https://developer.apple.com/documentation/bundleresources/information_property_list/nsbonjourservices) . More detail can be found in WWDC video https://developer.apple.com/videos/play/wwdc2020/10110/.
In iOS 14, new error [constant](https://developer.apple.com/documentation/foundation/nsnetserviceserror/nsnetservicesmissingrequiredconfigurationerror?language=objc) is given. In titanium, it need to added in Ti.Network.BonjureService and expose as error string.
Test Case -
How to Test - 1. Create an app using and add mentioned test case. 2. Run it on device with iOS 14. 3. Click on 'Publish Service'. It should show error in alert. 4. Add key 'NSLocalNetworkUsageDescription' and key 'NSBonjourServices' in tiapp.xml (see the doc). Run again. 5. Click on 'Publish Service'. It should show prompt to ask user permission. On click of 'Ok', it should show success alert. 6. Click on 'Start Searching', it should show success alert. 7. Delete the app from mobile. Remove the added keys from tiapp.xml. 8. Run again. 9. Click on 'Start Searching'. It should throw exception. 10. Add keys again as mentioned in step 4. 11. Run again. It should show prompt to ask user permission. Click 'Ok'. It should not throw exception.
PR - https://github.com/appcelerator/titanium_mobile/pull/11896
FR Passed. Waiting for Jenkins build
Verified on: Mac OS: 10.15.4 SDK: 9.2.0.v20200911073932, 9.3.0.v20200911052140 Appc CLI: 8.1.0 JDK: 11.0.4 Node: 10.17.0 Studio: 6.0.0.202005141803 Xcode: 12.0 Beta6 iPhone 7Plus(v14.0 Beta6)