Jul 21, 2010
When I revisited the settings screen on MyAppSales to add a switch it turned my stomach how I would have added it over a year ago versus to the way I’m doing it now.
The Old Way
Consider the following snipped just to get a similar nausea so that you can appreciate what I am going to show you afterwards. That’s from a random switch in cellForRowAtIndexPath.
NSString *CellIdentifier = @"ServerSectionSwitch";
SwitchCell *cell = (SwitchCell *)[tableView dequeueReusableCellWithIdentifier:
if (cell == nil)
cell = [[[SwitchCell alloc] initWithFrame:CGRectZero reuseIdentifier:
cell.titleLabel.text = @"Enable on WLAN";
ASiSTAppDelegate *appDelegate = (ASiSTAppDelegate *)[[UIApplication sharedApplication]
cell.switchCtl.on = appDelegate.serverIsRunning;
[cell.switchCtl addTarget:appDelegate action:@selector(startStopServer:)
So obviously I had created a custom tableview cell, so let’s glance at that as well.
Jul 21, 2010
Apple changed two column headings on the financial reports because apparently the June reports are the first ones which will also show eBook publishers their revenues.
- “Artist/Show/Developer” became “Artist/Show/Developer/Author”
- “Label/Studio/Network/Developer” became “Label/Studio/Network/Developer/Publisher”
There where quite a few hot fixes that I had to put into MyAppSales and also if you look at the code you’ll see that it’s in the middle of being migrated to CoreData. The latter is necessary because the current method of caching everything is really ugly code whereas CoreData will permit me to make the app perform way better and it only fetches data I truly need.
Unfortunately (or fortunately depending on how you look at it) I’m very busy with a major project for the last few months, so I cannot really muster the time right now to carry through this migration. But because this is a point of stability in MyAppSale’s live that I can publish it as a new version. Lots of people where continuing to use the previous “released” version because for some reason they feared that the “2.0 BETA” in the Subversion trunk might be unstable. When in reality it aways was the code I’ve been using on my iPhone.
Speaking of iPhone 4, you still need to build it with SDK 3.2 until further notice for exactly the reason I mentioned above: ugly caching. It works fine on my iPhone 4.
Here are some goodies that I also hacked into 1.0.16:
- Ability to remove individual reports. For example if something goes wrong during download.
- You can opt to show a report sum on the overview pages. This is slower because for it the app needs to fetch the sales data, so it will impact scrolling. But if you don’t scroll much then its a useful number to see at a glance.
- I’m now using the standard currency formatter for all amounts
Please update your copy from the repository as usual.
Jul 18, 2010
Lots of hoopla around “Antennagate”. Was it really worth it?
Podcast: Download (16.3MB)
The show notes and script after the break.
Jul 16, 2010
Being the experimenting kind I took screenshots of my iPhone 4 status bar before and after updating the software/firmware to 4.0.1.
In the Unofficial Apple Testing Labs (which double as my house) I have my summer office in a “back room”. This is at the back of my house due to lesser temperatures. So I was able to test a high db as well as a low db scenario. Note that this is regular GSM/EDGE connections, I don’t get 3G where I live.
The “Death Grip” was performed by cupping the left hand around the bottom of the phone making sure to touch the black strip with the base of my thumb.
You can actually feel how much stronger the reception is with fewer bars. See how much larger they are? 🙂
Jul 16, 2010
I’m interested in getting your questions because answering them helps me structure the material in my head. And there’s a saying that “what you teach you learn”, because of that.
Devin Snipes, an aspiring young iOS Developer asks:
Hello Dr. Touch,
My name is Devin Snipes, I’m 15 years old and I’m an iPhone Developer. I’ve been following your work for a little less than a year, and I’ve grown to love it. Your work is amazing, and I hope to someday be as good as you are in programming for the iOS platform. I currently have a few iPhone applications on the AppStore, but nothing compared to yours.
I’d like to ask you a few questions that will hopefully give me more insight on your developmental skills and how I can improve on my skill.
Well, “You catch more flies with honey than vinegar”. If somebody asks so nicely I’ll usually try to respond with something useful.
1. How did you become so great at programming for the iPhone?
I’m doing it full time only since last December. And before that I was looking at code on most days for a couple of hours. Do you know the rule of 10,000? It says that if you want to be world-class in any field you have to invest 10,000 hours in total. Before I got into developing for the iPhone I was collecting programming time for many years. So I probably reached 10,000 a while ago. But that’s not strictly Cocoa time. At 10 hours a day it takes you around 3 years to reach 10,000. So I’m probably around 5,000 hours doing iPhone stuff.
Jul 15, 2010
I previously explained how to use NSUserDefaults to your advantage, basically being the OSX equivalent to the Windows registry. User Defaults are the way how you can persist small amounts of data in a convenient way. They are basically dictionaries that the system takes care of for you with the added benefit of being cached in memory.
Today we’ll up it one notch. Session 124 of the WWDC 2010 videos brought to my attention the fact that there’s also a mechanism to provide default values for the defaults. Up until now I would have retrieved an object from the defaults, checked if it’s nil and then set the value. Consider the following code snipped from SpeakerClock:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSNumber *countdownNum = [defaults objectForKey:@"Countdown"];
countdown = [countdownNum doubleValue];
countdown = self.currentPreset.startDuration;
This works, but it’s not elegant. Wouldn’t it be great if we could pre-register those values so that a simple retrieval always has a result?
Jul 10, 2010
The iPhone 4 rulez, bar none.
Podcast: Download (19.1MB)
Show notes, aka “my script” after the break.
Jul 10, 2010
Yesterday I found an e-mail in my inbox that gave me a bit of a spooky feeling in my stomach. Ordinarily such a mail would have quickly ended up in my trash if it weren’t for the details they put in there.
Why would Microsoft be contacting me? They obviously did a bit of digging or reading to know that I created the apps for CCS Publishing. They didn’t bother to check on my references page though. The ACLS app was done by somebody else. But still it shows a fair amount of data mining as they appear to have checked those apps’ rankings and then cross referenced them with who was the real author.
Jul 04, 2010
UPDATE: Added handleOpenURL to the flow charts. Added UIApplicationExitsOnSuspend. Untangled some lines.
UPDATE: renamed deprecated handleOpenURL to newer name.
Now that we all are moving our source code gradually to iOS 4 I had to pause and think a bit about where to move which code. A problem that I’m facing frequently when updating a project is that the didFinishLaunching is only called if the app really launches.
That poses a bit of a challenge if you are used to doing things like refreshing images or other files off the internet. An app that is resumed from standby does no longer go through this delegate method. So an app that would always show fresh content upon launch before 4.0 multitasking would no longer load any new content as soon as you build it for 4.0. That’s actually one of the main reasons why I have not yet had time to update MyAppSales to 4.0.
To gain the possibility for “fast app switching” you actually don’t need to do anything. All apps automatically support it because they no longer get terminated if the user pushes the Home button. They get put into a sleep mode while the iPhone still has enough memory for everything else. It’s only if RAM runs out that the OS starts killing apps. There is begins with the ones that have the most memory reserved.
I grabbed the free trial of Omnigraffle and the Non-techie Process Flowchart Stencils by gfraser. Then I researched when all these various delegate methods of UIApplication are being called and drew charts to illustrate the flow.
By inhaling first how it was before multitasking and then upgrading your mental process to backgrounding we can begin to fully appreciate how it all fits together.