Category Archives: Rant

Why doesn’t apple just show the network activity indicator?

So, for real: Why doesn’t apple just turn on the network activity indicator when there’s traffic? I find it silly that I have to manage that. I mean, beyond just single-connection scenarios, if I have some process (let’s say, a UITableView) that is going to download multiple items, now I have to manually monitor the number of threads in use, and when that hits zero shut the indicator off.

And if I don’t, Apple is quite likely to reject my app, as it does not adhere to the development guidelines/standards they set up.

It seems like something this trivial should be handled by the FRAMEWORK, since they won’t allow me to directly access the API that, I’m rather sure KNOWS when the network is in use.

That said, here’s some code to do it for you – just call AddNetworkConnection and RemoveNetworkConnection (you can do it in a simpler format, but this is the more awesome way with read and writer locks);

public static class Utility
private static ReaderWriterLock rwl = new ReaderWriterLock();
private  static int Connections = 0;

public static void AddNetworkConnection()
rwl.AcquireReaderLock(TimeSpan.FromSeconds(1)); //You don't actually have to check, you can just always set this to true
if (Connections == 0)  // but I like to be fancy.
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

public static void RemoveNetworkConnection()
if (Connections < 0)
Connections = 0; //just in case, y'know?
if (Connections <= 0)
UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;

And that’s it, you’ve got a simple way to keep the Network Activity indicator updated.
If I were more awesome, I’d find a way to attach it to the thread accessing the network, and automatically decrement the count. But, this way works with both blocking and non-blocking calls. So meh.

Developers and Business Requirements

Developers actually like business requirements, from my experience. It tells us what we need to do, so that we can give you a piece of properly functioning software.

What I don’t like, however, is when we are asked to meetings to provide YOU with the business requirements. It’s kind of backwards. What I really dislike is when I ask you to provide an agenda and some questions to the meetings, and I’m given the response “Sorry, I was just assigned to this and that’s the best I can do” … what does that even mean?