I am using this example from Microsoft as the basics for UDP transfer using Xamarin, I have it working on Android with no problems but on iOS is crashing on the udpClient.Close().
Do you have to setup any special permissions on iOS to use UDP?
https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.udpclient?view=netcore-3.1
What we found iOS takes longer to process UDP packets, compared to Android so when we try a transfer using await/aync the process was never finishing before we requested another the UDP transfer. As the await/async had not opened a UDP channel, when we came to close it would generate an expectation.
Related
Following iOS 14 new policy of blocking access to local network, a com.apple.developer.networking.multicast special entitlement is needed to access the local network, and this access should be confirmed by user during an authorization dialog. Although this new feature is not thoroughly documented, Apple engineers have indicated in forums that this authorization dialog popup is only triggered when the app tries to send traffic, causing an issue for apps reading only the network, as indicated in iOS 14 How to trigger Local Network dialog and check user answer?
Unfortunately, the advice of sending some data to trigger the authorization dialog does not seem to work in our case, as we never got the popup dialog appearing.
Our app usually only receive UDP broadcast (no transmit except in a few cases). We have got the com.apple.developer.networking.multicast entitlement, have added it to our app entitlements, have added the requested NSLocalNetworkUsageDescription in our Info.plist and are signing our app manually using XCode 12.0 with a provisioning profile including this entitlement (manual code signing is needed in this case as indicated in https://developer.apple.com/forums/thread/656773?answerId=628537022). Since then, situation has somewhat improved as the UDP packet reception that was fully blocked before adding the entitlement started to work sometimes, but unfortunately not always (situation seems worse on iOS 14.0.1 than on iOS 14 and on iPhone than on iPad).
Most importantly, we never got the authorization dialog displayed and our app does not appear as authorized in Privacy/Local Network (even when UDP reception works). We suspect this may be the cause for this spurious reception issue. As it seems the authorization dialog is only shown when sending data, we configured our app to send data to the local network to try to trigger the dialog, using all below methods:
TcpSocket class (using CFStreamCreatePairWithSocketToHost) to connect to 192.168.1.1 on port 80 and send a few bytes (there is a device at this address)
using GCDAsyncSocket to connect and send a test TCP packet to same address/port
using GCDAsyncUdpSocket to create a UDP socket, enabling it for broadcast, then joinMulticastGroup 224.0.1.0 and broadcasting a test UDP packet on port 80.
using GCDAsyncUdpSocket to create a UDP socket, enabling it for broadcast, then broadcasting a test UDP packet on port 80 to 255.255.255.255.
reusing the example from Apple article (https://developer.apple.com/news/?id=0oi77447) sending multicast packets with NWConnectionGroup to 224.0.1.0
and finally using the triggerDialog() method of class LocalNetworkPermissionService indicated in iOS 14 How to trigger Local Network dialog and check user answer?
None of the above actions triggered the authorization dialog on iOS 14.0 and iOS 14.0.1, and our app is still not listed as authorized in Privacy/Local Network, with spurious reception of UDP packets.
If somebody has encountered the same issue and found a solution, many thanks for your advice.
Thanks to #Columbo and help from Apple, a solution has been found, although the root cause of the issue is not yet fully understood.
Our app was built with a iOS release deployment target of 9.0 because we tried to preserve compatibility with older devices. It seems a deployment target lower 12.0 may cause issue with the network privacy management. The solution was then:
to rebuild the app after updating the iOS deployment target to 12.0 or higher.
for all iOS 14.0 and 14.0.1 devices having a previous version of the app already installed, to fully delete the app and install it again (updating the app was not sufficient, the network privacy alert was still not shown).
Of course, this procedure is not ideal for users that will have to reinstall the app from scratch and configure it again. I will update this thread if a future version of iOS avoids this issue.
Update: when using iOS 14.2, the app is correctly triggering the network privacy alert even after an upgrade (without full deletion and reinstall). We then recommended our users to upgrade to 14.2 before upgrading our app. We have kept the deployment target at 12.0
To those who suddenly find that APP ask this authorization, and don't suppose it appear. The answer is that maybe your APP trying to connect to your test server which in same LAN with your iPhone running iOS 14.
For 14.2, the local network access is handled little better and there is a sample code used to trigger this alert as mentioned in https://developer.apple.com/forums/thread/663768
Also you can create dummy connection using NWConnection, this will trigger system dialogue for asking permission (if system dialogue is not shown anytime before) and check the local network access is allowed or not as mentioned in https://developer.apple.com/forums/thread/663769 , this is available from iOS 14.2.
I have a webRTC web app and an iOS WebRTC app. Both are using pubnub for signaling and this is working. I am using Xirsys for ICE. Everything works between the ios app and the web app until a packet is lost from web to ios. Once a packet is lost from the web video feed to the ios video feed the web video feed cuts out. But if a packet is lost from the ios app to the web app there is no problem.
On the iOS side I am using libjingle_peerconnection to handle the peer connections. Is there a way on the iOS side to just reduce the quality when packets are missing as opposed to just closing the feed.
the libjingle_peerconnection cocoapod is so old that it is no longer compatible with Chrome 56+. See here for more details including a workaround if you can't upgrade.
I want to develop a Security-App for iOS-Devices and while I was brainstorming about the functionalities a question arose, which I wasn't able to answer by browsing through Google and other search engines:
Is it possible to get a list of all current inbound/outbound network connections of an iOS Device?
As I intend to write my application in Swift 3 I would be grateful for any hints/links/code examples.
Thank you very much!
iOS does not support packet tracing directly. However, if you connect your iOS device to a Mac via USB, you can use an macOS packet trace program to gather and analyze traces using the remote virtual interface feature.
For a testing App i need to get network information from iOS. In Android there are API's available to obtain packets sent, received, size of them in bytes, and some other information. Is there anything similar in Apple iOS?
More deep information obtained with pcap C library can be used without Jailbreak?
More deep information obtained with pcap C library can be used without Jailbreak?
Not by running a libpcap-based program on iOS, because Darwin, by default, makes the BPF devices openable only by root, so, on {OS X, iOS, tvOS} only a process running with root privileges can use libpcap to capture network traffic; without jailbreaking, you can't run a program as root on iOS (or tvOS).
However, with iOS 5 or later, you can use the remote virtual interface facility in iOS and OS X to let a program running on a Mac see the traffic received and sent by an iOS machine.
In my blackberry application I'm establishing network connection by appending ;deviceSide=true in the url. It is working fine on simulator but its not working on device. I've correct APN settings as other third party apps are running fine.
Please let me know the possible reason for this issue!!!
Its not necessary that your app always connect via direct TCP.
For taking care all types of networks available in blackberry for your app refer this article.
How to programmatically connect to the internet in blackberry
Network Diagnostic Tool
download this network diagnostic tool developed by RIM and check weather direct TCP is working or not in your mobile.