Saturday, December 18, 2010

How to fix Xcode build error 'Directroy "/XYX/" following -F not found'

I started working on iTimeZone HD, the iPad release, for real today and something pretty weird happened.

I created a new target as a stand alone iPad application based on my current iTimeZone iPhone target. Once I built, first thing I see is this message:

warning: directory '"Macintosh HD/Users/YourName/Code/Project"' following -F not found

This doesn't happen on the iPhone target, and it took me a while to figure out what was going on. Here's what you do to get rid of this annoying message:

  1. Get Info on your Target (e.g. iTimeZone HD)
  2. Click on the Build tab
  3. In the Configuration drop down, select All Configurations
  4. In the search box enter Framework
  5. You should see Framework Search Paths in the results. Click on it.
  6. Press delete
  7. Close the info window and rebuild

You're warning should now be gone.

Saturday, December 04, 2010

Best Way to Implement Private Methods in Objective-C

Since the iPhone SDK came out, I've been using the following syntax in my Objective-C implementation file (the .m) to implement private methods:

@interface ClassName (Private) - (void)privateMethod; @end

@implementation ClassName - (void)privateMethod { //keep this private }
@end

This style just creates a Category for your class that's not in the header, so other classes can't read it. Turns out there was an even better way introduced in the Objective-C 2.0 spec using Extensions, which are like anonymous categories, but the improvement is the implementation must exist in the main implementation block for the class. Here's the example re-written:

@interface ClassName () - (void)privateMethod; @end

@implementation ClassName - (void)privateMethod { //keep this private } @end

Not much has changed, instead of decorating your category with a name, (Private), you just put empty parenthesis, ().

Once I switched over the iTimeZone code base, realized I was carrying some dead weight method declarations, so win!

Here's Apple's documentation.

Update
Check out bbum's comment for additional syntactical sweetness to make private/public properties with property redeclaration.

Thursday, November 11, 2010

Software Development Paradox: The Closer You Are To Zero Bugs The Less You Want To Test

iTimeZone 1.4 reached zero known bugs earlier today and I feel some paralysis. Part of me doesn't want to test anymore because then I will likely find bugs I didn't know about, putting zero known bugs at risk! The other part of me is screaming "Run the fraking test scripts and ship already!"

So yeah, writing this was a stalling tactic, but it made me feel like I was back in control of why I was feeling some paralysis. If nothing else, at least I got to revel in the glory of zero known bugs for a few hours.

Wednesday, November 10, 2010

iTimeZone 1.4 Coming Soon

I've been working on iTimeZone 1.4 iPhone and iPod touch for a long time. iTimeZone 1.3.5 shipped in May 2010, which ended a serious of releases containing incremental bug fix and feature adjustments. I had originally intended to finish an iPad version of iTimeZone for release in early summer, but it got totally derailed. Here's what's coming in iTimeZone 1.4 and what took so long.

iPhone 4 Retina Display Graphics
As iOS developers quickly discovered, the increase over original iPhone - 3GS in required pixels for images means a redo of all assets. I certainly didn't have enough foresight to create all my image assets @2X the needed size, some probably did. iTimeZone 1.4 won't be the last app to get Retina Display images, but in hindsight, should have got the images done and shipped 1.3.6 until holding them until now.

iOS 4 Multitasking
No big deal, it's just a simple recompile right? Yes and no. Yes, you get multitasking enabled in your app for "free" once you recompiled with a 4.x SDK. But you still had to handle those state changes gracefully, for example dumping unnecessary memory caches to be a good citizen. Also, apps that use the Settings app have to handle settings changes once an app is brought out of sleep and made active. Sounds easy, but it took more time to get right than I would have thought because changing the way your app starts exposes all kinds of bugs you never dreamed of.

Better Location Detection
iTimeZone 1.3 added location detection so users could look up cities based on where they were. In my testing before that release, it worked really well. A developers famous last words. Through user feedback post-release and subsequent testing, I realized that the algorithm I used was just not working well enough in large cities. This was a case of App Store reviews being fair, for some it wasn't working and I was getting "1 starred" for it, and rightly so.

I don't know how tough of a problem correlating location data to a database of cities is for other apps or developers, but this has been by far the hardest feature to get to "It Just Works". This feature alone has taken months of development, and caused numerous cascading refactors. The biggest refactor was for the database controller code. I had wanted to clean up this technical debt for other upcoming features, but it burned a lot of time.

There is more testing to be done but in iTimeZone 1.4, location detection is much much better. If more testing confirms, it might even be "It Just Works" good using a combination refinements to the algorithm I used in 1.3 and a reverse geocoding service. This was my first web service call in iOS, so a lot of learning on how to do that right as well. This happens in parallel so as soon as the app gets location info from the device, the user should see results very fast, and should never be left with "Couldn't determine location" unless the device doesn't give it to the app.

This is also the main culprit for iTimeZone for iPad not shipping, I didn't want to ship another big release without fixing this feature.

70,000 More Cities, Fastest Searches Ever
Users always ask for more cities, even the tinniest cities, so I want to give them that. iTimeZone 1.4 is using the biggest city database my existing data provider freely offers. When you increase the size of your data by 4.5X, query performance usually goes down. I saw a decrease in search times putting the new database in 1.3, not even making some of the other changes I wanted to for grouping results.

Grouping the results really slowed things down, and I hate waiting for a device to give me data. Since I was partially refactoring the database controller for the location querying requirements, I just decided to go the whole way to get the maximum parallelism I could using modern OS structures, NSOperationQueue and NSOperation, instead of a query thread with critical section locks in numerous methods. On iPhone 4 and iPhone 3GS with iOS 4.x, a queries first result returns in 1-2 seconds, with lower importance results streaming in a little later.

User Experience Improvements
All of the above are certainly UX improvements, but this part is purely about app flow. In iTimeZone 1.3, when you first opened the app, you immediately got herded into the "Find Current City" screen. If location detection didn't work for you, you had a really bad experience. Now, the app loads into the main screen with some simple directions for the user on what to do. There are a couple other places this happens as well, I think by going just a little slower, the app feels better because users understand the spatial model of the app as soon as the open it. The previous approach could be categorized as "why are you prepared, just go".

The other feature I am constantly asked about is how to change the current city. For a long list of releases, if the user double-tapped any city in their list, it would swap places with the current city. There were also specific buttons in a couple that could be tapped on, but not on the main screen. Problem with a gesture like that, users have to know it's there. So I added a tip on the bottom of the user's city list table telling them how to change the current city. I will definitely be tweaking this again in upcoming releases, maybe implement something on swipe as well, but I hope this makes it more obvious.

Pruning The Source
For the source code to remain healthy, some things had to be removed. Upgrading from the 2.5 year old iTimeZone 1.0 user city storage format was dropped. This slowed every app load down, and highly likely no one left in the world is on iTimeZone 1.0.

iTimeZone 1.4 will only support iOS 3.2 and higher, so long 3.1.3. I posted about SQLite versions in iOS the other day because the SQLite build on iOS 3.1.3 is just not working with one of my queries. Every other device I have & simulator with iOS 4.x works great. Don't think I'm going to revisit this, Apple has moved on, so am I.

What Didn't Make It?
iOS 4 for some reason dropped a lot of time zone abbreviation data iTimeZone was using. I'm going to add my own data set for this, including military time zone names, in iTimeZone for iPad 1.0 and iTimeZone for iPhone 1.4.1

What's Next?
A beta release to private testers in the next couple days, more testing, and then start putting the iPad version back together. I have multiple Subversion merges to look forward to.

Tuesday, November 09, 2010

SQLite Versions Correlated to iOS Versions

As part of developing and testing iTimeZone 1.4 (still in development), I ran into an issue that is only reproducible on iOS 3.1.3. I hadn't been paying attention to the version of SQLite that Apple has been shipping with iOS, but I gathered the info to try and see if that might be the cause of the bug I was seeing. Here it is for posterity:

iOS VersionSQLite Version
3.1.33.6.12
4.0.23.6.22
4.1.03.6.23.2
4.2.03.6.23.2

Wednesday, October 27, 2010

iOS & Mac App Betas Should Be Distributed by the App Store

David Chartier strongly suggested on Twitter that every iOS developer drop what they are doing and sign up for TestFlight, which allows beta testers to download builds of your app over the air.

I had heard of and registered for TestFlight a few weeks ago, but the apps in private beta and I haven't got passed the velvet rope.

After seeing the FaceTime for Mac registration process, it hit me that signing up beta testers should be that easy and handled by Apple. I mean no offense or disruption to the people at TestFlight who sound like they have done amazing work, but this is a job for the App Store itself.

The current Ad Hoc distribution system, which iOS developers use for beta testing, is a huge source of friction. To manage this process, developers have to:

  1. Educate users about what UUIDs are, how to get them, and send them in.
  2. Register a finite number of devices per year on the app store to use for Ad Hoc distribution.
  3. Manage the Ad Hoc provisioning profile to include beta tester devices.
  4. Keep the Ad Hoc profile current on all developer machines.
  5. Distribute the beta build, profile, and instructions on how to get the build into iTunes.
  6. Support strange or busted configurations for testers when things go wrong.
  7. Repeat 1-6 whenever a tester gets a new device or replaces an existing device.

If the App Store handled beta build distribution, here's how it would work:

  1. Tester gives developer their beta tester handle (think like Game Center)
  2. Developer adds that handle to the beta tester tab in iTunes Connect.
  3. Developer uploads beta builds to iTunes Connect.
  4. Tester is notified they've been asked to be a tester for App X. Tester agrees and gets builds through the App Store on device or in iTunes.

This proposal brings the following benefits:

  • Tester devices are managed by the App Store, developers never have to know many there are or when they change.
  • Registering testers for a developers app is a one time process. Of course, either the tester or developer could opt out.
  • Testers get installation and app updates just as they expect with production apps. (Beta's could be badged by the OS).
  • Developers could get crash logs and perhaps console output of their apps through iTunes Connect.
  • Apple could add a crash reporter panel to iOS that only appears to when a beta crashes.

The overall result though would be an increase in quality of apps since more builds would be tested by more people since the process gets so much easier. I hope something like this comes in iOS 5.

Monday, October 11, 2010

Note To Future Time Travelers, Bring Me To The Future!

David Frampton, maker of Chopper and Chopper 2 for iOS, tweeted that we live in crappy times because we're between earth and space exploration periods. I responded saying we don't have a problem because time travelers can just bring us to the future where all the space exploration goodness is.

I want to make it explicit. If somehow you are reading this in the future and we've figured out time travel, please come take me to the future so I can experience time and space travel for myself.

Thanks, Dave

P.S. Trust me, I am totally ready for space and time travel.

Friday, September 03, 2010

iTunes 10 Icon Needs Replacing and Here's a Great Candidate

Completely stunning that Apple shipped iTunes 10 with the icon pictured to the left. I don't know why they didn't finally kill the iTunes brand and replace it with something more consistent with all that iTunes does, but small victories, at least the CD is gone. But this icon is just a blue background, with a highlight behind the note, and that's it. Feels seriously amateur, like it was whipped up in an hour or two without much thought to it, just sloppy branding.
Thank Twitter and Dan Benjamin for tweeting this link which has an awesome iTunes 10 desktop icon replacement that uses the visual identity Apple has already established with the iTunes icons on iPhone, iPod touch, and iPad. I won't spoil it for you by posting the image here, just click this link for the iTuned 10 icon replacement you need but Apple doesn't think you deserve!

Saturday, July 17, 2010

The Real Lesson for Apple over the iPhone 4 Antenna Issue

The July 16 iPhone 4 Special Press Conference was an interesting affair. If you haven't watched the video or read a live blog, you need to. Also check out Apple's site on smartphone antenna performance.

The Real Lesson
Let's state for the sake of argument the following:

  • All smartphone's have at least 1 spot on then where a wrap-around hand hold can attenuate the signal
  • iPhone 4 is the only smartphone that has a permanent bullseye on its weak spot
  • The ability to attenuate any smartphone is due to a number of variables including:
    • Hands wetness/dryness
    • Position relative to cell tower, i.e. is your body between smartphone and tower
    • Signal strength algorithm is non-standard between mobile OSes
    • Build quality, aka fit and finish, of individual units.
You may or may not be able to attenuate your phone at any given time using a death grip due to the interaction of all the above (and likely more) variables. I only today after owning an iPhone 3GS for over a year learned how to attenuate the device at will when holding it bare. I can't replicate this at work in NYC so far. In a case, I can't attenuate anywhere.

The conclusion seems obvious: signal attenuation due to hand position is a mobile industry open secret.

Apple, re-emergent in the last decade as a tech powerhouse, is the seeming antithesis of nearly all other consumer electronic and software companies. Apple doesn't settle for the good enough solution, they go for the best within their constraints and look good doing it. That's their MO, it's their DNA. The perception that Apple is only as good as the competition would be a company and brand damaging situation. They set themselves up, and users hold them to, the highest possible standards with their products. You tend to do that when words like magical and revolutionary are being thrown around. Except this time, Apple accepted a trade-off that signal attenuation performance was good enough.

Apple listened to its antenna engineers, surely some of the smartest folks on the planet. I'm betting they said signal attenuation performance comparable to competitive smartphones was acceptable, much better could not currently be achieved. You could think of this as the "but everyone's doing it" defense we all at one time as children use, but that doesn't make it right. Remember, putting the antenna inside the iPhone 3GS does not eliminate attenuation, only an electrically insulated material can do that, like rubber, latex, or plastic, hence the free bumper offer for iPhone 4 buyers. So Apple signed off on iPhone 4 design because in they're testing, the iPhone 4 as other's have reported has better reception in weak signal areas, no doubt due to its new external antenna design.

Once the story broke that iPhone 4 could be attenuated and the reproduction steps were easy, due to the visible gap, the eyeball whore media ran the story into the ground. Few "news organizations" were doing any real scientific reporting (AnandTech was a notable exception, within their limits) on this being an industry wide problem, they just smelled blood in the water, on a tech titan.

This is where Apple has their Microsoft moment, not specifically a Vista moment, but an "attack the winner" moment characterized by negative poorly researched hit pieces that only come when you are the alpha dog, or very close to it, which Microsoft has endured for ages. The lesson from this incident should be sobering: The sharks are going to come for Apple now whenever the tinniest drop of blood is smelled in the water. Since they've set themselves up as the premier high quality consumer electronic and software company, they won't get a meter of wiggle room, especially on flagship products. As thorough as Apple seems to have been on testing iPhone 4, they have to raise their game. They shouldn't accept, and their users certainly don't, a scenario where Apple goes along with the status quo. That seems to be what happened with iPhone 4 signal attenuation performance. I don't think Apple as it currently is could survive to many more negative press drubbings like this without permanent damage. But hey if it all goes south, Apple could just put Steve Jobs shirtless on a horse and sent personalized twitter video replies instead of emails to turn the ship around. Or just hire Isiah Mustafa, the Old Spice guy!

Saturday, July 10, 2010

iTimeZone 2 Year Anniversary Sale For $0.99 & U.S. Promo Codes

iTimeZoneToday is the 2 year anniversary of the release ofiTimeZone for iPhone and iPod touch on the App Store. Of course, it runs on the iPad and iPhone 4, but versions optimized for those devices are still in the works.

To celebrate the anniversary, iTimeZone is going on sale for $0.99 through the weekend. Sale should kick off any minute now. I've already started the party with a batch of 5 U.S. promo codes through a twitter post, but here are 10 more:

96JJRRYTH67H
M4YNTFMNH3L4
3NJEFEWALM99
MENFJL7HTRLM
Y3KXFY3WP34N
ARMLFWY7PR43
94YML9RA4KA3
XLNHTEJRJWEP
W6LFFXW34TPA
WTKFR6NNJY3W