Check number of active network connection iOS app makes - instruments

“Network Connection” instrument shows what are the network connections that app is making if we use “Connection Summary” in drop down menu.
a) Does the connections that it shows are the total connections that app has made till now.
Or
b) Does it shows the current total number of connections which are live at present.
If it is case #b, I think our app is making number of connections and is not cleaning it.
Can anyone answer if it is #a or #b ?

Related

Azure SignalR understanding connection count

I am a bit confused with the Azure SignalR connection count. When I run my MVC.NET on my Visual Studio debug mode, it immediately creates 10 server connections. So, I carefully looked at the documentation (https://learn.microsoft.com/en-us/azure/azure-signalr/signalr-concept-messages-and-connections) and it said that
By default, each application server starts with five initial connections per hub, and each client has one client connection.
For example, assume that you have two application servers and you define five hubs in code. The server connection count will be 50: 2 app servers * 5 hubs * 5 connections per hub.
Well using the formula above, I should only have 5 connections because: 1 app server * 1 hub * 5 connections per hub = 5 connections. I can't understand why my portal showed that I have 10 server connections instead of 5.
Can anyone help to explain how Azure calculates the server connection?
Thanks...
UPDATE
For those who looking on how to enable Live Trace Tools:
Go to SignalR
Click on the SignalR that you want to trace
Click on Monitoring | Diagnostic Settings
If you haven't configure your log, click on "Configure Log Destination Settings" (Note: I think the cheapest way is to store under your storage account with retention of 1 day).
Tick Enable Live Trace and click Save
Open Live Trace Tool (it should say "Connected" on the top right corner)
Click on Capture
Start your app
Go to Diagnostics Settings under Monitoring tab in Azure portal SignalR service.
Click on "Open Live Trace Tool" button.
Click on Capture in newly opened window.
When you run your application, all connections would be shown in Live Trace.

How to present guest Wi-Fi "terms & conditions" confirmation dialog programmatically?

It is typical setup in bars / restaurants / airports where password-free Wi-Fi is available but requires accepting terms & conditions.
First time customer manually connects to Wi-Fi network which brings confirmation dialog and he accepts it. As result internet connection is alive, no problem here.
However next time customer visits the same place iOS device automatically connects to the known Wi-Fi and shows active Wi-Fi connection icon in status bar. But internet connection isn't available until customer accepts terms & conditions again. To do that customer has to either go to iOS settings or open Safari which brings confirmation dialog automatically.
Our app is designed for bars. Based on above iOS behavior regular customer sees that it has Wi-Fi connection in iPhone status bar, yet our app says "No internet connection". Combined this is very confusing UX.
Question: Is there programatic way to bring Wi-Fi confirmation dialog the same way as Safari does?
iOS should do this automatically if your captive portal is configured correctly.
When it connects to a WiFi network, iOS checks to see if http://captive.apple.com returns "success". If it does then it assumes that it has Internet access. If it returns any other content then it assumes that there is a captive portal and it will open the captive portal authentication screen.
This behaviour is independent of whether the user has connected to that hotspot previously.
Where there can be an issue is when the hotspot de-authenticates the user after some time, as iOS does not continually re-try http://captive.apple.com once it has connected successfully.
Your app can periodically check that http://captive.apple.com returns the correct response and open an SFSafariViewController if it doesn't

AppStore: will app relying on network be approved?

I develop a well-looking professionally designed application, which loads events for some clubs at startup (it has more functionality, but all require network connection).
If there's no internet access, app shows "Error: No network access" message with OK button. It exits when user presses this button.
Will it be accepted in App Store? If no, what should I change?
Thanks! :)
This is an opinion question, but my experiences suggest:
It's OK that your app requires network access to provide meaningful content.
Do NOT forcibly terminate (exit) your app in this case, but instead show a helpful message, and keep polling the network status (ie use something like Reachability). If and when the network connectivity comes back, remove the message and proceed.
Bonus points: If you can cache data from when there is a connection, then you can run the app anyway showing the most recent data you have. This is generally preferable as a user experience to simply blocking access to the UI if you can't get to the internet.
Do not exit the application.
If your app work only if network is available, that's okay. But if network is not there, it would be better if you show an empty view with proper message (That for this app, network is needed or something like that. Add some error images or graphics it'll improve the user experience also). Don't forcefully close the app, it can be consider as a crash(Apple will reject your app).

How can one app provide data to another without swiching apps?

Scenario:
I "control" two different apps, App A and App B, both which the user has installed
App A is running
App A needs to obtain a string that was set by App B when App B last ran.
After obtaining the string, App A will still be running
User should not receive any feedback this communication is happening. E.g. no "switching animations" between A or B, no pop-ups, etc.
Constraints:
Apps are released under different vendors
Apps are already in the app store; updated versions will have this communication ability.
It is acceptable for the data stored in App B to be accessible to other apps on the device.
It is not acceptable for the data stored in App B to be visible to general third parties (e.g. if an external server is used, there needs to be some sort of secured scheme)
The data read should be able to occur immediately upon App A being opened after install. For instance, I cannot require the user of App A to enter log in credentials for an external communication service.
Must work on non-jailbroken devices.
This is seeming rather difficult to pull off in iOS7. Help is appreciated.
Tricky work around. Not recommended, but it will get the job done if you can't afford servers.
On the first app create a contact in the user's contacts book. Give it a generic name like "000 - NameOfAppB Data - Don't Delete" (I start with "000" so it goes to the bottom of the users contact book so they never see it, I also add "don't delete" so if the user does somehow find it they don't delete it hahaha) (who looks at contact books anyways). In the contact info under notes add your NSData in string format.
Then when app A is opened search for that contact, read the data, then delete the contact.
Apple does allow you to create and delete users contacts without their permission. (At least in 2011 they did, this may have changed).
This might serve your purpose
https://developer.apple.com/library/ios/documentation/Security/Reference/keychainservices/Reference/reference.html
I am not sure of its limitations though, i have seen implementations where credentials have been shared between apps.

iPhone SDK Internet connection detection

I'm working on an iPhone application that makes a few calls to web services. I posted this application on the Apple store but it got rejected (and rightly so) since there was no error message displayed to the user if no Internet connection is available. Since obviously the application would not work without it.
So I just wanted to know how to best achieve this? I'm guessing something needs to go in the viewDidLoad method that will throw an alert box saying something like "You need an Internet connection to use this application".
Any ideas would be appreciated.
If your application must have network access the easiest way is to add the following settings to your info.plist as boolean values.
SBUsesNetwork - Ensure the device has an active connection (Edit: not applicable, this seems to be a private API someone found at some point. It is not in Apple's developer documentation.)
UIRequiresPersistentWiFi - Ensures the device is connected via WiFi
If your choice is not true then the user will be presented with an appropriate message when starting your application. Best of all this message is from the OS and thus is localized.
If your application cannot download data from a website while running (loss of signal, site down) you should still warn the user though and not just spin indefinitely.
Apple Developer Connection has a sample application (Reachability) that uses the System Configuration framework to determine network status. It will tell you whether you have a WiFi, EDGE/3G or no Internet connection.
You would use portions of this code in your application to determine network state, and then provide interface cues if no connection is available, such as a UIAlertView.
Cautionary word: beware SBUsesNetwork. I would personally love to know where SBUsesNetwork originally came from, because it's not mentioned anywhere in Apple's docs that I can find. When I add the key to my app's plist (as a boolean) and set to true, it doesn't seem to affect the behaviour of my app -- I get no warning about airplane mode, whether starting app completely afresh, or foregrounding a previous launch that was backgrounded.
My app has UIRequiresPersistentWifi set to true, which appears to also do the job people claim SBUsesNetwork does (plus other things!).
(I'm running iOS4.2.1 on an iPhone 4, XCode 3.2.5 64 bit).

Resources